Consumer Insights Analysis Using Word Embeddings

ABSTRACT

In one embodiment, a method includes receiving a request to identify k steps for a particular entity to acquire a target attribute in public sentiments, accessing a table of word vector relationships, looking up an entity word vector corresponding to the entity name and a target attribute word vector corresponding to the n-gram representing the target attribute using the table, determining a directional vector in the d-dimensional embedding space that connects from the entity word vector to the target attribute word vector, identifying k points on the directional vector that evenly split the directional vector into k+1 segments, selecting, for each of the k points, a word vector that is closest to the point, identifying, for each of the k selected word vectors, a corresponding n-gram by looking up the word vector in the table, and sending a response message comprising the k identified n-grams.

PRIORITY

This application is a continuation under 35 U.S.C. § 120 of U.S. patentapplication Ser. No. 15/862,074, filed 4 Jan. 2018.

TECHNICAL FIELD

This disclosure generally relates to analyzing public insights based ona word embedding model trained with a corpus of text generated by usersof an online social network.

BACKGROUND

A social-networking system, which may include a social-networkingwebsite, may enable its users (such as persons or organizations) tointeract with it and with each other through it. The social-networkingsystem may, with input from a user, create and store in thesocial-networking system a user profile associated with the user. Theuser profile may include demographic information, communication-channelinformation, and information on personal interests of the user. Thesocial-networking system may also, with input from a user, create andstore a record of relationships of the user with other users of thesocial-networking system, as well as provide services (e.g., wall posts,photo-sharing, event organization, messaging, games, or advertisements)to facilitate social interaction between or among users.

The social-networking system may send over one or more networks contentor messages related to its services to a mobile or other computingdevice of a user. A user may also install software applications on amobile or other computing device of the user for accessing a userprofile of the user and other data within the social-networking system.The social-networking system may generate a personalized set of contentobjects to display to a user, such as a newsfeed of aggregated storiesof other users connected to the user.

SUMMARY OF PARTICULAR EMBODIMENTS

In particular embodiments, the social-networking system may analyzepublic insights based on a word embedding model that is trained with alarge corpus of text collected from content objects created by theonline social network users. An n-gram may be represented as a vector ina d-dimensional embedding space, where the vector may represent thesemantic context of the corresponding n-gram as a point in the vectorspace. The vector may be referred to as a word embedding. Each vectormay comprise coordinates corresponding to a particular point in theembedding space, where each coordinate corresponds to a particularfeature. A similarity metric of two vectors in the embedding space canbe calculated. A similarity metric may be a cosine similarity, aEuclidean distance, a Jaccard similarity coefficient, or any suitablesimilarity metric. A similarity metric of two vectors may represent howthe two corresponding n-grams are semantically similar to one another. Aword embedding model may be trained with a large corpus of text. Adictionary to map a plurality of unique n-grams to corresponding wordvectors may be created using the trained word embedding model. When aword vector for an n-gram is needed, the word vector may be searched bylooking up the n-gram in the dictionary. Alternatively, an n-gram may bemapped to a vector representation in the embedding space by processingthe n-gram with the word embedding model. The word embedding model maybe a machine learning model (e.g., a neural network). An online socialnetwork may be able to train the word embedding model with a corpus oftext generated by a large number of the online social network users.Because the online social network users may represent general populationwell, word vectors in the embedding space generated by the online socialnetwork may properly reflect sentiments of the contemporary public.

The embodiments disclosed herein are only examples, and the scope ofthis disclosure is not limited to them. Particular embodiments mayinclude all, some, or none of the components, elements, features,functions, operations, or steps of the embodiments disclosed above.Embodiments according to the invention are in particular disclosed inthe attached claims directed to a method, a storage medium, a system anda computer program product, wherein any feature mentioned in one claimcategory, e.g., method, can be claimed in another claim category, e.g.,system, as well. The dependencies or references in the attached claimsare chosen for formal reasons only. However any subject matter resultingfrom a deliberate reference to any previous claims (in particularmultiple dependencies) can be claimed as well, so that any combinationof claims and the features thereof are disclosed and can be claimedregardless of the dependencies chosen in the attached claims. Thesubject matter which can be claimed comprises not only the combinationsof features as set out in the attached claims but also any othercombination of features in the claims, wherein each feature mentioned inthe claims can be combined with any other feature or combination ofother features in the claims. Furthermore, any of the embodiments andfeatures described or depicted herein can be claimed in a separate claimand/or in any combination with any embodiment or feature described ordepicted herein or with any of the features of the attached claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1A-1B illustrate example procedures of training a word embeddingmodel using a corpus of text collected from content objects created byonline social network users.

FIG. 2 illustrates an example of identifying a number of word vectorsclosest to a word vector corresponding to a particular subject.

FIG. 3 illustrates an example method for identifying k keywords relatedto a particular subject on receiving a request.

FIG. 4 illustrates an example of identifying k word vectors closest toan average vector that represents a relationship between two concepts.

FIG. 5 illustrates an example method for identifying k wordsapproximating a relationship between two concepts on receiving arequest.

FIG. 6 illustrates an example visualization of public sentiments for aparticular subject on a 2-dimensional space.

FIG. 7 illustrates an example method for visualizing public sentimentsfor a particular subject on a 2-dimensional space.

FIG. 8 illustrates an example of an analogy completion in the embeddingspace.

FIG. 9 illustrates an example method for performing an analogycompletion based on word embeddings on receiving a request.

FIG. 10 illustrates an example visualization of public sentiments for aparticular subject in a plurality of clusters.

FIG. 11 illustrates an example method for visualizing public sentimentsfor a particular subject in a plurality of clusters.

FIG. 12 illustrates an example of identifying k steps from an entityvector to a target attribute vector in the embedding space.

FIG. 13 illustrates an example method for identifying k steps for aparticular entity to acquire a target attribute on receiving a request.

FIG. 14 illustrates an example similarity metrics between entities andattributes.

FIG. 15 illustrates an example method for identifying public sentimentsfor one or more entities on receiving a request.

FIG. 16 illustrates an example similarity metrics for each pair ofentities.

FIG. 17 illustrates an example method for identifying a similarity inpublic sentiments for each pair from a plurality of entities.

FIG. 18 illustrates an example network environment associated with asocial-networking system.

FIG. 19 illustrates an example view of a vector space 1900.

FIG. 20 illustrates an example computer system.

DESCRIPTION OF EXAMPLE EMBODIMENTS

In particular embodiments, the social-networking system 1860 may analyzepublic sentiments based on word embeddings generated by a word embeddingmodel that is trained with a large corpus of text collected from contentobjects created by the online social network users. An n-gram may berepresented as a vector in a d-dimensional embedding space, where thevector may represent the semantic context of the corresponding n-gram asa point in the vector space. The vector may be referred to as a wordembedding. Each vector may comprise coordinates corresponding to aparticular point in the embedding space, where each coordinatecorresponds to a particular feature. A similarity metric of two vectorsin the embedding space can be calculated. A similarity metric may be acosine similarity, a Euclidean distance, a Jaccard similaritycoefficient, or any suitable similarity metric. A similarity metric oftwo vectors may represent how the two corresponding n-grams aresemantically similar to one another. A word embedding model may betrained with a large corpus of text. A dictionary to map a plurality ofunique n-grams to corresponding word vectors may be created using thetrained word embedding model. When a word vector for an n-gram isneeded, the word vector may be searched by looking up the n-gram in thedictionary. Alternatively, an n-gram may be mapped to a vectorrepresentation in the embedding space by processing the n-gram with theword embedding model. The word embedding model may be a machine learningmodel (e.g., a neural network). An online social network may be able totrain the word embedding model with a corpus of text generated by alarge number of the online social network users. Because the onlinesocial network users may represent general population well, word vectorsin the embedding space generated by the online social network mayproperly reflect sentiments of the contemporary public.

Training a Word Embedding Model

In particular embodiments, the social-networking system 1860 mayconstruct a corpus of text by collecting text content from contentobjects created by users of the online social network. In particularembodiments, the social-networking system 1860 may collect text contentfrom only content objects created during a pre-determined period oftime. The social-networking system 1860 may train a word embedding modelusing the corpus of text as training data, where the word embeddingmodel may generate a word vector for a given input n-gram. The wordvector may represent a semantic context of the corresponding n-gram as apoint in a d-dimensional embedding space. The social-networking system1860 may identify a list of unique n-grams appearing in the corpus oftext. The social-networking system 1860 may generate, using the wordembedding model, a table of word vector relationships comprising thelist of unique n-grams and their corresponding word vectors. The tableof word vector relationships may be referred to as an embeddingdictionary. The table may represent results of the word embedding modeltrained using the corpus of text as training data. The word embeddingmodel may be trained using a word embedding training framework (e.g.,Fasttext). Because the online social network users may represent generalpopulation well and a number of the collected content objects fortraining the word embedding model is large, word vectors in the tablemay properly reflect insights of the contemporary public. In particularembodiments, the social-networking system 1860 may need to analyzeinsights of a particular subset of users. The particular subset may becharacterized by one or more conditions. In such a case, thesocial-networking system 1860 may construct a corpus of text bycollecting text content from content objects created by online socialnetwork users that satisfy the one or more conditions. In particularembodiments, the social-networking system 1860 may collect text contentfrom only content objects created during a pre-determined period oftime. The social-networking system 1860 may train the word embeddingmodel using the corpus of text as training data. The social-networkingsystem 1860 may identify a list of unique n-grams appearing in thecorpus of text. The social-networking system 1860 may generate the tableof word vector relationships using the word embedding model. The wordvectors in the table may properly reflect insights of the group of usersbecause the word embedding model was trained using a large corpus oftext created by the group of users as training data. Although thisdisclosure describes training a word embedding model with a large corpusof text collected from content objects created by the online socialnetwork users in a particular manner, this disclosure contemplatestraining a word embedding model with a large corpus of text collectedfrom content objects created by the online social network users in anysuitable manner.

FIG. 1A illustrates an example procedure of training a word embeddingmodel using a corpus of text collected from content objects created byonline social network users. At step 105A, the social-networking system1860 may collect content objects from one or more data store 1864 of theonline social network. The social-networking system 1860 may collectonly content objects created during a pre-determined period of time. Thesocial-networking system 1860 may construct a corpus of text bycollecting text content from the content objects. At step 110A, thesocial-networking system 1860 may train a word embedding model using thecorpus of text as training data. At step 115A, the social-networkingsystem 1860 may generate a table of word vector relationships. Togenerate the table, the social-networking system 1860 may identify alist of unique n-grams appearing in the corpus of text. For each of then-grams in the identified list, the social-networking system 1860 maygenerate a corresponding word vector using the trained word embeddingmodel. Although this disclosure describes training a word embeddingmodel using a corpus of text collected from content objects in theonline social network in a particular manner, this disclosurecontemplates training a word embedding model using a corpus of textcollected from content objects in the online social network in anysuitable manner.

In particular embodiments, the social-networking system 1860 mayconstruct a corpus of text by collecting text content from contentobjects created by users of the online social network. An online socialnetwork may have a large number of users. The users may generate contentobjects to express themselves. User-generated content may includeanything a user can add, upload, send, or “post” to social-networkingsystem 1860. As an example and not by way of limitation, a usercommunicates posts to social-networking system 1860 from a client system1830. Posts may include data such as status updates or other textualdata, location information, photos, videos, links, music or othersimilar data or media. In particular embodiments, public sentiments on aparticular subject may change over time. The social-networking system1860 may collect text content from only content objects created during apre-determined period of time. The pre-determined period of time may,for example, be the last one year to ensure that the word vectorsgenerated by the word embedding model reflect up-to-date publicinsights. Although this disclosure describes constructing a corpus oftext by collecting text content from user-generated content objects in aparticular manner, this disclosure contemplates constructing a corpus oftext by collecting text content from user-generated content objects inany suitable manner.

In particular embodiments, the social-networking system 1860 may train aword embedding model using the corpus of text as training data, wherethe word embedding model may generate a word vector for a given inputn-gram. The word embedding model may be a machine learning model (e.g.,a neural network). The word vector may represent a semantic context ofthe corresponding n-gram as a point in a d-dimensional embedding space.The word embedding model may utilize either of two model architecturesto produce a distributed representation of words: continuousbag-of-words (CBOW) or continuous skip-gram. In the continuousbag-of-words architecture, the word embedding model may predict thecurrent word from a window of surrounding context words. The order ofcontext words may not influence prediction. In the continuous skip-gramarchitecture, the word embedding model may use the current word topredict the surrounding window of context words. The skip-gramarchitecture may weigh nearby context words more heavily than moredistant context words. Although this disclosure describes training aword embedding model in a particular manner, this disclosurecontemplates training a word embedding model in any suitable manner.

In particular embodiments, the social-networking system 1860 mayidentify a list of unique n-grams appearing in the corpus of text. Thesocial-networking system 1860 may generate, using the word embeddingmodel, a table of word vector relationships 101 comprising the list ofunique n-grams and their corresponding word vectors. In particularembodiments, the table of word vector relationships 101 may be generatedas a result of training the word embedding model. The table of wordvector relationships 101 may be referred to as an embedding dictionary.The table 101 may represent results of the word embedding model trainedusing the corpus of text as training data. The online social networkusers may represent general population without bias thanks to a largenumber of users. Also, a number of the collected content objects fortraining the word embedding model may be large. Therefore, word vectorsin the table 101 may properly reflect insights of the contemporarypublic. Although this disclosure describes generating a table of wordvector relationships in a particular manner, this disclosurecontemplates generating a table of word vector relationships in anysuitable manner.

FIG. 1B illustrates an example procedure of training a word embeddingmodel using a corpus of text collected from content objects created by aparticular group of online social network users. The particular groupmay be characterized by one or more conditions. At step 105B, thesocial-networking system 1860 may collect content objects from one ormore data store 1864 of the online social network. At step 107B, thesocial-networking system 1860 may filter the content objects and collecta content object if the generating user satisfies the one or moreconditions. The social-networking system 1860 may collect only contentobjects created during a pre-determined period of time. Thesocial-networking system 1860 may construct a corpus of text bycollecting text content from the collected content objects. At step110B, the social-networking system 1860 may train a word embedding modelusing the corpus of text as training data. At step 115B, thesocial-networking system 1860 may generate a table of word vectorrelationships. To generate the table, the social-networking system 1860may identify a list of unique n-grams appearing in the corpus of text.For each of the n-grams in the identified list, the social-networkingsystem 1860 may generate a corresponding word vector using the trainedword embedding model. Although this disclosure describes training a wordembedding model using a corpus of text collected from content objectsgenerated by a group of users in a particular manner, this disclosurecontemplates training a word embedding model using a corpus of textcollected from content objects generated by a group of users in anysuitable manner.

In particular embodiments, the social-networking system 1860 may need toanalyze insights of a particular subset of the online social networkusers. The particular subset may be characterized by one or moreconditions. In such a case, the social-networking system 1860 mayconstruct a corpus of text by collecting text content from contentobjects created by online social network users that satisfy the one ormore conditions. In particular embodiments, the social-networking system1860 may collect text content from only content objects created during apre-determined period. The social-networking system 1860 may train theword embedding model using the corpus of text as training data. Thesocial-networking system 1860 may identify a list of unique n-gramsappearing in the corpus of text. The social-networking system 1860 maygenerate the table of word vector relationships 101 using the wordembedding model. The word vectors in the table 101 may properly reflectinsights of the group of users because the word embedding model wastrained using a large corpus of text created by the group of users astraining data. As an example and not by way of limitation, thesocial-networking system 1860 may want to analyze sentiments of youngmothers regarding a particular subject. Young mothers may becharacterized by a list of conditions including being a female, agedbetween 25 and 44, and having one or more children. Thesocial-networking system 1860 may construct a corpus of text fromcontent objects created by users that satisfy the conditions. Thesocial-networking system 1860 may train the word embedding model usingthe constructed corpus of text as training data. The social-networkingsystem 1860 may generate the table of word vector relationships by usingthe trained word embedding model. Although this disclosure describestraining a word embedding model by collecting text from content objectsgenerated by a subset of users in a particular manner, this disclosurecontemplates training a word embedding model by collecting text fromcontent objects generated by a subset of users in any suitable manner.

Keywords Generation

In particular embodiments, the social-networking system 1860 maygenerate k keywords related to a particular subject on receiving arequest from a computing device. The request may include an input n-gramrepresenting the particular subject. In particular embodiments, therequest may comprise one or more conditions characterizing an audience.In such a case, the social-networking system 1860 may train the wordembedding model with a corpus of text collected from content objectscreated by a group of users who satisfy the one or more conditions. Thesocial-networking system 1860 may access the table of word vectorrelationships 101. The social-networking system 1860 may look up a firstword vector corresponding to the input n-gram using the table 101. Thesocial-networking system 1860 may, for each n-gram in the table 101,calculate a similarity metric to the first word vector. Thesocial-networking system 1860 may select k word vectors from the wordvectors in the table 101 closest to the first word vector in theembedding space based on the calculated similarity metric. In particularembodiments, the similarity metric is a cosine similarity. In particularembodiments, the similarity metric is a Euclidean distance. Inparticular embodiments, the similarity metric is a Jaccard similaritycoefficient. The social-networking system 1860 may identify acorresponding n-gram for each of the selected word vectors by looking upthe selected word vector in the table 101. The social-networking system1860 may send a response message to the computing device. The responsemessage may include the identified n-grams. The identified n-grams maybe semantically close to the particular subject because theircorresponding word vectors are close to the first word vectorcorresponding to the input n-gram representing the particular subject. Athird-party user associated with the computing device may evaluatepublic sentiments regarding the particular subject based on thegenerated keywords. Although this disclosure describes generating aplurality of keywords related to a particular subject in a particularmanner, this disclosure contemplates generating a plurality of keywordsrelated to a particular subject in any suitable manner.

In particular embodiments, the social-networking system 1860 may receivea request to generate k keywords related to a particular subject from acomputing device. A third-party user associated with the computingdevice may want to understand a number of keywords that are close to aparticular subject in public perceptions. The request may include aninput n-gram representing the particular subject. In particularembodiments, the request may comprise one or more conditionscharacterizing an audience. In such a case, the social-networking system1860 may train the word embedding model with a corpus of text collectedfrom content objects created by a group of users who satisfy the one ormore conditions. As an example and not by way of limitation, athird-party user may want to understand keywords close to ‘family’because the third-party user may want to create ad strategies focusingon family for a product. The social-networking system 1860 may receive arequest to generate k keywords contextually tied closely with ‘family.’Although this disclosure describes receiving a request to generatekeywords close to a particular subject in a particular manner, thisdisclosure contemplates receiving a request to generate keywords closeto a particular subject in any suitable manner.

FIG. 2 illustrates an example of identifying a number of word vectorsclosest to a word vector corresponding to a particular subject. Inparticular embodiments, the social-networking system 1860 may access thetable of word vector relationships 101. The social-networking system1860 may look up a word vector corresponding to the input n-gram bylooking up the input n-gram in the table 101. The word vectorcorresponding to the input n-gram may be represented as a first point201 in the embedding space 1900. The table 101 may include all themono-grams and selected multi-grams appeared in the corpus of text. Inother words, the table 101 may include all the vocabularies that usersare using in their content objects. The social-networking system 1860may, for each n-gram in the table 101, calculate a similarity metric tothe first word vector. The social-networking system 1860 may select kword vectors from the word vectors in the table 101 closest to the firstword vector in the embedding space based on the calculated similaritymetric. In particular embodiments, the similarity metric is a cosinesimilarity. In particular embodiments, the similarity metric is aEuclidean distance. In particular embodiments, the similarity metric isa Jaccard similarity coefficient. In the example illustrated in FIG. 2,the social-networking system 1860 selects four word vectors 210, 220,230, and 240 from the word vectors in the table 101 because they areclosest to the first word vector 201. In particular embodiments, thesocial-networking system 1860 may identify a corresponding n-gram foreach of the selected word vectors by looking up the selected word vectorin the table 101. As an example and not by way of limitation, continuingwith the prior example, the social-networking system 1860 may look up afirst word vector 201 corresponding to the input n-gram ‘family.’ Bycomputing a similarity metric for each word vectors in the table 101with the first word vector 201, the social-networking system 1860 mayselect four closest word vectors: 210, 220, 230, and 240. Thesocial-networking system 1860 may identify that the correspondingn-grams for the word vectors 210, 220, 230, and 240 are ‘cousin,’‘condolences,’ ‘relatives,’ and ‘grandchildren’ by looking up the wordvectors 210, 220, 230 and 240 in the table 101. Although this disclosuredescribes identifying closest keywords for a particular subject in aparticular manner, this disclosure contemplates identifying closestkeywords for a particular subject in any suitable manner.

The social-networking system 1860 may send a response message to thecomputing device. The response message may include the identifiedn-grams. The identified n-grams may be semantically close to theparticular subject because their corresponding word vectors are close tothe first word vector corresponding to the input n-gram representing theparticular subject. A third-party user associated with the computingdevice may evaluate public sentiments regarding the particular subjectbased on the generated keywords. As an example and not by way oflimitation, continuing with the prior example, the social-networkingsystem 1860 may send a response including ‘cousin,’ ‘condolences,’‘relatives,’ and ‘grandchildren’ as identified top keywords closelyrelated to ‘family.’ The third-party user may decide to focus on‘relatives’ and ‘grandchildren’ when the third-party user creates the adstrategies based on the identified keywords. Although this disclosuredescribes sending the identified keywords in a particular manner, thisdisclosure contemplates sending the identified keywords in any suitablemanner.

FIG. 3 illustrates an example method 300 for identifying k keywordsrelated to a particular subject on receiving a request. The method maybegin at step 310, where the social-networking system 1860 may receive,from a second computing device, a request to generate k keywords each ofwhich is semantically related to a particular subject, wherein therequest comprises an input n-gram representing the particular subject.At step 320, the social-networking system 1860 may access a table ofword vector relationships, wherein the table comprises a plurality ofunique n-grams and their corresponding word vectors, wherein each of theword vectors represents a semantic context of a corresponding n-gram asa point in a d-dimensional embedding space. At step 330, thesocial-networking system 1860 may look up, using the table, a first wordvector corresponding to the input n-gram. At step 340, thesocial-networking system 1860 may select, using the table and based on asimilarity metric, k word vectors closest to the first word vector inthe embedding space. At step 350, the social-networking system 1860 mayidentify, for each of the selected word vectors, a corresponding n-gramby looking up the selected word vector in the table. At step 360, thesocial-networking system 1860 may send, to the second computing device,a response message comprising the identified n-grams. Particularembodiments may repeat one or more steps of the method of FIG. 3, whereappropriate. Although this disclosure describes and illustratesparticular steps of the method of FIG. 3 as occurring in a particularorder, this disclosure contemplates any suitable steps of the method ofFIG. 3 occurring in any suitable order. Moreover, although thisdisclosure describes and illustrates an example method for identifying kkeywords related to a particular subject on receiving a requestincluding the particular steps of the method of FIG. 3, this disclosurecontemplates any suitable method for identifying k keywords related to aparticular subject on receiving a request including any suitable steps,which may include all, some, or none of the steps of the method of FIG.3, where appropriate. Furthermore, although this disclosure describesand illustrates particular components, devices, or systems carrying outparticular steps of the method of FIG. 3, this disclosure contemplatesany suitable combination of any suitable components, devices, or systemscarrying out any suitable steps of the method of FIG. 3.

Concept Intersection

In particular embodiments, the social-networking system 1860 may receivea request to generate k words that each approximates a representation ofa relationship between two concepts from a computing device. The requestmay include two input n-grams that each represents one of the twoconcepts. In particular embodiments, the request may comprise one ormore conditions characterizing an audience. In such a case, thesocial-networking system 1860 may train the word embedding model with acorpus of text collected from content objects created by a group ofusers who satisfy the one or more conditions. The social-networkingsystem 1860 may access a table of word vector relationships 101. Thesocial-networking system 1860 may look up word vectors corresponding toeach of the two input n-grams by looking up the two input n-grams in thetable 101. The social-networking system 1860 may calculate an averagevector by taking a weighted average of the word vectors corresponding tothe two input n-grams. The social-networking system 1860 may assign aweight to each of the two word vectors for calculating the weightedaverage. The weight assigned to a word vector may be an Inverse DocumentFrequency (IDF) score for the corresponding n-gram. The IDF score may bebased on a number of documents containing the corresponding n-gram in acorpus of text. The IDF score for an n-gram may be a measure reflectingthe specificity of the n-gram. The social-networking system 1860 may,for each n-gram in the table 101, calculate a similarity metric to theaverage vector. The social-networking system 1860 may select k wordvectors from the word vectors in the table 101 closest to the averagevector in the embedding space 1900. In particular embodiments, thesimilarity metric is a cosine similarity. In particular embodiments, thesimilarity metric is a Euclidean distance. In particular embodiments,the similarity metric is a Jaccard similarity coefficient. Thesocial-networking system 1860 may identify a corresponding n-gram foreach of the selected word vectors by looking up the selected word vectorin the table. The social-networking system 1860 may send a responsemessage to the computing device. The response message may include theidentified n-grams. The identified n-grams may approximate arepresentation of a relationship between two concepts represented by theinput n-grams. Although this disclosure describes generating a pluralityof n-grams approximating a representation of a relationship between twoconcepts in a particular manner, this disclosure contemplates generatinga plurality of n-grams approximating a representation of a relationshipbetween two concepts in any suitable manner.

In particular embodiments, the social-networking system 1860 may receivea request to generate k words that each approximates a representation ofa relationship between two concepts from a computing device. The onlinesocial network may have a large corpus of text collected from contentobjects generated by users. Because a number of users generating thecontent objects may be large and the users may be well distributed interms of demographics, the corpus of text may represent contemporarypublic sentiments. A third-party user associated with the computingdevice may want to understand a relationship between two concepts. Thethird-party user may send the request to the social-networking system1860. The request may include two input n-grams that each represents oneof the two concepts. In particular embodiments, the request may compriseone or more conditions characterizing an audience. In such a case, thesocial-networking system 1860 may train the word embedding model with acorpus of text collected from content objects created by a group ofusers who satisfy the one or more conditions. As an example and not byway of limitation, a cereal manufacturer may want to initiate apromotional campaign for a new breakfast cereal. The manufacturer hasdetermined “positive energy” as a main theme for the campaign. Themanufacturer may want to understand a relationship between the maintheme and a target audience (e.g., moms of age between 25 and 44). Thesocial-networking system 1860 may receive a request to generate k wordsthat approximates a representation of a relationship between‘positivity’ and ‘mom.’ The request may also include conditionscharacterizing the target audience such as female, age between 25 and44, and having a child. The social-networking system 1860 may constructthe corpus of text by collecting content objects created by users thatsatisfy the conditions. The social-networking system 1860 may train theword embedding model using the corpus of text as training data. Thesocial-networking system 1860 may generate a table of word vectorrelationships 101 using the trained word embedding model. As anotherexample and not by way of limitation, the cereal manufacturer may alsowant to understand a relationship between the main theme (i.e., positiveenergy, or positivity) and the target product (i.e., breakfast). Thesocial-networking system 1860 may receive a request to generate k wordsthat approximates a representation of a relationship between‘positivity’ and ‘breakfast.’ Although this disclosure describesreceiving a request to generate words approximating a representation ofa relationship between two concepts in a particular manner, thisdisclosure contemplates receiving a request to generate wordsapproximating a representation of a relationship between two concepts inany suitable manner.

FIG. 4 illustrates an example of identifying k word vectors closest toan average vector that represents a relationship between two concepts.In particular embodiments, the social-networking system 1860 may accessa table of word vector relationships 101. The social-networking system1860 may look up word vectors 401, 402 corresponding to each of the twoinput n-grams by looking up the two input n-grams in the table 101. Thesocial-networking system 1860 may calculate an average vector 403 bytaking a weighted average of the word vectors corresponding to the twoinput n-grams. The social-networking system 1860 may assign a weight toeach of the two word vectors for calculating the weighted average. Theweight assigned to a word vector may be an Inverse Document Frequency(IDF) score for the corresponding n-gram. The IDF score may be based ona number of documents containing the corresponding n-gram in a corpus oftext. Though certain terms, such as ‘is,’ ‘of,’ and ‘that,’ may appear alot of times, those terms have little importance. Thus, the IDF scoremay weigh down the frequent terms while scale up the rare terms. The IDFscore for an n-gram may be a measure reflecting specificity of then-gram. As an example and not by way of limitation, continuing with theprior example, the social-networking system 1860 may identify two wordvectors 401 and 402 corresponding to ‘positivity’ and ‘moms,’respectively, by looking up ‘positivity’ and ‘moms’ in the table 101.The social-networking system 1860 may calculate an average vector 403 bytaking an average of two word vectors 401 and 402. As another exampleand not by way of limitation, the social-networking system 1860 mayidentify word vector 401 corresponding to ‘positivity’ and word vector402 corresponding to ‘breakfast’ by looking up ‘positivity’ and‘breakfast’ in the table 101. The social-networking system 1860 maycalculate an average vector 403 by taking a weighted average of wordvectors 401 and 402, where an IDF score for the corresponding word isthe weight applied to a word vector. Although this disclosure describescalculating an average word vector in a particular manner, thisdisclosure contemplates calculating an average word vector in anysuitable manner.

In particular embodiments, the social-networking system 1860 may, foreach n-gram in the table 101, calculate a similarity metric to theaverage vector. When the social-networking system 1860 calculates theaverage vector 403, no word vectors in the table 101 may match theaverage vector 403. Thus, the social-networking system 1860 may select kword vectors from the word vectors in the table 101 closest to theaverage vector in the embedding space 1900. The selected k word vectorsmay approximate a representation of a relationship between the twoconcepts. In particular embodiments, the similarity metric is a cosinesimilarity. In particular embodiments, the similarity metric is aEuclidean distance. In particular embodiments, the similarity metric isa Jaccard similarity coefficient. The social-networking system 1860 mayidentify a corresponding n-gram for each of the selected word vectors bylooking up the selected word vector in the table. As an example and notby way of limitation, continuing with the prior example, after thesocial-networking system 1860 calculates an average vector 403 of wordvectors 401 and 402 corresponding to ‘positivity’ and ‘moms,’ thesocial-networking system 1860 may select four word vectors 410, 420,430, and 440 that are closest to the average vector 403 in terms of thecalculated similarity metric. The social-networking system 1860 mayidentify that the selected word vectors correspond to ‘motivation,’‘awesomeness,’ ‘vibes,’ and ‘enthusiasm’ by looking up the word vectors410, 420, 430, and 440 in the table 101. As another example and not byway of limitation, the social-networking system 1860 may calculate anaverage vector 403 by taking a weighted average of word vectors 401 and402 that correspond to ‘positivity’ and ‘breakfast.’ Thesocial-networking system 1860 may select four word vectors 410, 420,430, and 440 closest to the average vector 403 by comparing thecalculated similarity metrics. The social-networking system 1860 mayidentify that word vectors 410, 420, 430, and 440 correspond to‘motivation,’ ‘negativity,’ ‘brunch,’ and ‘positive’ by looking up theword vectors 410, 420, 430, and 440 in the table 101. Although thisdisclosure describes identifying words approximating a representation ofa relationship between two concepts in a particular manner, thisdisclosure contemplates identifying words approximating a representationof a relationship between two concepts in any suitable manner.

In particular embodiments, the social-networking system 1860 may send aresponse message to the computing device. The response message mayinclude the identified n-grams. The identified n-grams may approximate arepresentation of a relationship between two concepts represented by theinput n-grams. A third-party user associated with the computing devicemay evaluate a relationship between two concepts represented by theinput n-grams based on the k n-grams in the response message. As anexample and not by way of limitation, continuing with the prior example,the social-networking system 1860 may send a response including‘motivation,’ ‘awesomeness,’ ‘vibes,’ and ‘enthusiasm’ as identified topwords approximating a relationship between ‘positivity’ and ‘moms.’ Thecereal manufacturer may use the words to determine whether theircampaign theme was decided suitably for the target audience and todevelop their promotional campaign further. Although this disclosuredescribes sending the identified words in a particular manner, thisdisclosure contemplates sending the identified words in any suitablemanner.

FIG. 5 illustrates an example method 500 for identifying k wordsapproximating a relationship between two concepts on receiving arequest. The method may begin at step 510, where the social-networkingsystem 1860 may receive, from a second computing device, a request togenerate k words that each approximates a representation of arelationship between two concepts, wherein the request comprises twoinput n-grams that each represents one of the two concepts. At step 520,the social-networking system 1860 may access a table of word vectorrelationships, wherein the table of word vector relationships comprisesa plurality of unique n-grams and their corresponding word vectors,wherein each of the word vectors represents a semantic context of acorresponding n-gram as a point in a d-dimensional embedding space. Atstep 530, the social-networking system 1860 may look up, using thetable, word vectors corresponding to each of the two input n-grams. Atstep 540, the social-networking system 1860 may calculate an averagevector by taking a weighted average of the word vectors corresponding tothe two input n-grams. At step 550, the social-networking system 1860may select, using the table and based on a similarity metric, k wordvectors closest to the average vector in the embedding space. At step560, the social-networking system 1860 may identify, for each of theselected word vectors, a corresponding n-gram by looking up the selectedword vector in the table. At step 570, the social-networking system 1860may send, to the second computing device, a response message, theresponse message comprising the identified n-grams. Particularembodiments may repeat one or more steps of the method of FIG. 5, whereappropriate. Although this disclosure describes and illustratesparticular steps of the method of FIG. 5 as occurring in a particularorder, this disclosure contemplates any suitable steps of the method ofFIG. 5 occurring in any suitable order. Moreover, although thisdisclosure describes and illustrates an example method for identifying kwords approximating a relationship between two concepts on receiving arequest including the particular steps of the method of FIG. 5, thisdisclosure contemplates any suitable method for identifying k wordsapproximating a relationship between two concepts on receiving a requestincluding any suitable steps, which may include all, some, or none ofthe steps of the method of FIG. 5, where appropriate. Furthermore,although this disclosure describes and illustrates particularcomponents, devices, or systems carrying out particular steps of themethod of FIG. 5, this disclosure contemplates any suitable combinationof any suitable components, devices, or systems carrying out anysuitable steps of the method of FIG. 5.

Digestible Visualization

In particular embodiments, the social-networking system 1860 may receivea request to generate a two-dimensional visualization of publicsentiments regarding a particular subject. The request may include aninput n-gram representing the particular subject. In particularembodiments, the request may comprise one or more conditionscharacterizing an audience. In such a case, the social-networking system1860 may train the word embedding model with a corpus of text collectedfrom content objects created by a group of users who satisfy the one ormore conditions. The social-networking system 1860 may construct a firstcorpus of text by collecting text containing the input n-gram from aplurality of user-created content objects in the online social network.In case the request comprises one or more conditions characterizing anaudience, the social-networking system 1860 may construct the firstcorpus of text by collecting text containing the input n-gram from aplurality of content-objects in the online social network created byusers that satisfy the one or more conditions. The social-networkingsystem 1860 may identify a list of unique n-grams appearing in the firstcorpus of text. The social-networking system 1860 may generate a firsttable comprising unique n-grams in the list and their corresponding wordvectors using a word embedding model. The social-networking system 1860may condense the d-dimensional word vectors in the table into atwo-dimensional word vectors by performing a t-distributed StochasticNeighbor Embedding (t-SNE) dimensionality reduction on the word vectorsin the first table. The social-networking system 1860 may determine aTerm Frequency-Inverse Document Frequency (TF-IDF) ranking of then-grams in the first table. The social-networking system 1860 may sendinstructions to display n-grams in the first table on a two-dimensionaldisplay space, where each n-gram is placed at a location of thecorresponding condensed word vector. In particular embodiments, theinstructions may include instructions to adjust a font size for eachn-gram based at least on a respective TF-IDF rank assigned to then-gram. In particular embodiments, the instructions may includeinstructions to adjust a font color for an n-gram based at least on arespective TF-IDF rank assigned to the n-gram. If a number of n-grams inthe first table exceeds a threshold, the instructions may includeinstructions to display only n-grams with TF-IDF ranks higher than apre-determined value. Although this disclosure describes visualizingpublic sentiments regarding a particular subject in a particular manner,this disclosure contemplates visualizing public sentiments regarding aparticular subject in any suitable manner.

In particular embodiments, the social-networking system 1860 may receivea request to generate a two-dimensional visualization of keywordsrepresenting public sentiments regarding a particular subject. Theonline social network may have a large corpus of text collected fromcontent objects generated by users. Because the number of usersgenerating the content objects may be large and the users may be welldistributed in terms of demographics, the corpus of text may representcontemporary public sentiments. A third-party user may want tounderstand public sentiments around a particular subject. Thetwo-dimensional visualization of keywords representing public sentimentsmay be an intuitive tool for the third-party user to understand publicsentiments. The third-party user may send the request to thesocial-networking system 1860 to generate a two-dimensionalvisualization of keywords representing public sentiments regarding theparticular subject. The request may include an input n-gram representingthe particular subject. In particular embodiments, the request maycomprise one or more conditions characterizing an audience. In such acase, the social-networking system 1860 may train the word embeddingmodel with a corpus of text collected from content objects created by agroup of users who satisfy the one or more conditions. As an example andnot by way of limitation, a third-party user may be studying publicperceptions about ‘basketball.’ The third-party user may want to see anumber of keywords closely related to ‘basketball’ in public sentiments.The third-party user may send a request to visualize keywordsrepresenting public sentiments regarding ‘basketball’ in atwo-dimensional space to the social-networking system 1860. Althoughthis disclosure describes receiving a request to generate atwo-dimensional visualization of keywords in a particular manner, thisdisclosure contemplates receiving a request to generate atwo-dimensional visualization of keywords in any suitable manner.

In particular embodiments, the social-networking system 1860 mayconstruct a first corpus of text by collecting text containing the inputn-gram from a plurality of user-created content objects in the onlinesocial network. If the request comprises one or more conditionscharacterizing an audience, the social-networking system 1860 mayconstruct the first corpus of text by collecting text containing theinput n-gram from a plurality of content-objects in the online socialnetwork created by users that satisfy the one or more conditions. Thesocial-networking system 1860 may identify a list of unique n-gramsappearing in the first corpus of text. The social-networking system 1860may generate a first table comprising unique n-grams in the list andtheir corresponding word vectors using a word embedding model. As anexample and not by way of limitation, continuing with the prior example,the social-networking system 1860 may collect user-generated contentobjects that contain ‘basketball.’ The social-networking system 1860 mayconstruct a corpus of text by collecting text data from the collectedcontent objects. The social-networking system 1860 may generate a tablecomprising unique n-grams appearing in the corpus of text and theircorresponding word vectors. The n-grams in the table co-occur with‘basketball.’ Thus, the n-grams in the table may be more related withthe concept of ‘basketball’ than the other n-grams. As another exampleand not by way of limitation, the request may include ‘female,’‘not-married,’ and ‘age between 20-40’ as conditions for the targetaudience. In that case, the social-networking system 1860 may collectonly content objects generated by users satisfying the conditions. Thesocial-networking system 1860 may construct a corpus of text bycollecting text data from the collected content objects. Thesocial-networking system 1860 may generate a table comprising uniquen-grams appearing in the corpus of text and their corresponding wordvectors. Although this disclosure describes generating a tablecomprising unique n-grams co-occurring with the input n-gram and theircorresponding word vectors in a particular manner, this disclosurecontemplates generating a table comprising unique n-grams co-occurringwith the input n-gram and their corresponding word vectors in anysuitable manner.

The social-networking system 1860 may condense the d-dimensional wordvectors in the first table into a two-dimensional word vectors byperforming a t-distributed Stochastic Neighbor Embedding (t-SNE)dimensionality reduction on the word vectors in the first table. t-SNEis a non-linear dimensionality reduction algorithm used for exploringhigh-dimensional data. t-SNE maps multi-dimensional data to two or moredimensions suitable for human observation. In particular embodiments,the social-networking system 1860 may condense the d-dimensional wordvectors in the first table into a two-dimensional word vectors by usingany other suitable dimension reduction algorithms including hierarchicalclustering. The social-networking system 1860 may perform a TermFrequency-Inverse Document Frequency (TF-IDF) ranking of the n-grams inthe first table. TF-IDF is a way to score the importance of n-grams in adocument based on how frequently the n-grams appear across multipledocuments. If an n-gram appears frequently in a document, the n-gram maybe an important one. The social-networking system 1860 may assign a highscore to the n-gram. However, some n-grams (e.g., the, is, a, that) mayappear frequently in many documents. The social-networking system 1860may lower the score for those n-grams as those n-grams are not unique.The social-networking system 1860 may rank the n-grams based oncorresponding TF-IDF scores. Although this disclosure describescondensing d-dimensional word vectors into two-dimensional word vectorsin a particular manner, this disclosure contemplates condensingd-dimensional word vectors into two-dimensional word vectors in anysuitable manner.

The social-networking system 1860 may send instructions to displayn-grams in the first table on a two-dimensional display space, whereeach n-gram is placed at a location of the corresponding condensed wordvector. In particular embodiments, the instructions may includeinstructions to adjust a font size for each n-gram based at least on arespective TF-IDF rank assigned to the n-gram. In particularembodiments, the instructions may include instructions to adjust a fontcolor for an n-gram based at least on a respective TF-IDF rank assignedto the n-gram. If a number of n-grams in the first table exceeds athreshold, the instructions may include instructions to display onlyn-grams with TF-IDF ranks higher than a pre-determined value. FIG. 6illustrates an example visualization of public sentiments for aparticular subject on a 2-dimensional space. As an example and not byway of limitation, continuing with the prior example, thesocial-networking system 1860 may send a response message includinginstructions to display n-grams in the table on a two-dimensionaldisplay space. As illustrated in FIG. 6, the instructions may includeinstructions to adjust a font size and a color for an n-gram based onassigned TF-IDF rank. The instructions may include instructions todisplay only n-grams with TF-IDF ranks higher than a threshold to makesure not too many n-grams are displayed. Although this disclosuredescribes displaying n-grams in a two-dimensional display space in aparticular manner, this disclosure contemplates displaying n-grams in atwo-dimensional display space in any suitable manner.

FIG. 7 illustrates an example method 700 for visualizing publicsentiments for a particular subject on a 2-dimensional space. The methodmay begin at step 710, where the social-networking system 1860 mayreceive a request to generate a two-dimensional visualization of publicsentiments regarding a particular subject, wherein the request comprisesan input n-gram representing the particular subject. At step 720, thesocial-networking system 1860 may construct a first corpus of text bycollecting text containing the input n-gram from a plurality ofuser-created content objects in the online social network. At step 730,the social-networking system 1860 may identify a list of unique n-gramsappearing in the first corpus of text. At step 740, thesocial-networking system 1860 may generate, using a word embeddingmodel, a table comprising unique n-grams in the list and theircorresponding word vectors, wherein the word embedding model was trainedusing a second corpus of text collected from a plurality of user-createdcontent objects in the online social network as training data, whereineach of the word vectors represents a semantic context of acorresponding n-gram as a point in a d-dimensional embedding space. Atstep 750, the social-networking system 1860 may condense thed-dimensional word vectors in the table into a two-dimensional wordvectors. At step 760, the social-networking system 1860 may send, as aresponse to the request, instructions to display n-grams in the table ona two-dimensional display space, wherein each n-gram is placed at alocation of the corresponding condensed word vector. Particularembodiments may repeat one or more steps of the method of FIG. 7, whereappropriate. Although this disclosure describes and illustratesparticular steps of the method of FIG. 7 as occurring in a particularorder, this disclosure contemplates any suitable steps of the method ofFIG. 7 occurring in any suitable order. Moreover, although thisdisclosure describes and illustrates an example method for visualizingpublic sentiments for a particular subject on a 2-dimensional spaceincluding the particular steps of the method of FIG. 7, this disclosurecontemplates any suitable method for visualizing public sentiments for aparticular subject on a 2-dimensional space including any suitablesteps, which may include all, some, or none of the steps of the methodof FIG. 7, where appropriate. Furthermore, although this disclosuredescribes and illustrates particular components, devices, or systemscarrying out particular steps of the method of FIG. 7, this disclosurecontemplates any suitable combination of any suitable components,devices, or systems carrying out any suitable steps of the method ofFIG. 7.

Analogy Completion

In particular embodiments, the social-networking system 1860 may receivea request to identify a word representing a target concept that is in afirst relationship with a particular concept based on that a firstreference concept is in a second relationship with a second referenceconcept, the first relationship being analogous to the secondrelationship. The request may comprise a particular n-gram representingthe particular concept, a first reference n-gram representing the firstreference concept, and a second reference n-gram representing the secondreference concept. In particular embodiments, the request may compriseone or more conditions characterizing an audience. In such a case, thesocial-networking system 1860 may train the word embedding model with acorpus of text collected from content objects created by a group ofusers who satisfy the one or more conditions. The social-networkingsystem 1860 may access the table of word vector relationships 101. Thesocial-networking system 1860 may look up a particular word vectorcorresponding to the particular n-gram, a first reference word vectorcorresponding to the first reference n-gram, and a second reference wordvector corresponding to the second reference n-gram by looking up theparticular n-gram, the first reference n-gram, and the second referencen-gram in the table 101. The social-networking system 1860 may determinea target vector such that a first directional vector from a pointrepresented by the first reference word vector to a point represented bythe second reference word vector is equal to a second directional vectorfrom a point represented by the particular word vector to a pointrepresented by the target vector. The first directional vector and thesecond directional vector are said to be equal if the vectors have thesame magnitude and the same direction. The social-networking system 1860may compute the target vector by adding the second reference vector tothe particular word vector and subtracting the first reference vectorfrom the particular word vector. The social-networking system 1860 may,for each n-gram in the table 101, calculate a similarity metric to thetarget vector. The social-networking system 1860 may select a targetword vector closest to the target vector in the embedding space 1900based on the calculated similarity metrics. In particular embodiments,the similarity metric is a cosine similarity. In particular embodiments,the similarity metric is a Euclidean distance. In particularembodiments, the similarity metric is a Jaccard similarity coefficient.The social-networking system 1860 may identify a target n-gramcorresponding to the target word vector by looking up the target wordvector in the table. The social-networking system 1860 may send aresponse message comprising the target n-gram. Although this disclosuredescribes performing an analogy completion based on word embeddings in aparticular manner, this disclosure contemplates performing an analogycompletion based on word embeddings in any suitable manner.

In particular embodiments, the social-networking system 1860 may receivea request to identify a word representing a target concept that is in afirst relationship with a particular concept based on that a firstreference concept is in a second relationship with a second referenceconcept, the first relationship being analogous to the secondrelationship. The request may comprise a particular n-gram representingthe particular concept, a first reference n-gram representing the firstreference concept, and a second reference n-gram representing the secondreference concept. A directional relationship from a concept ‘man’ to aconcept ‘woman’ is well-known. Then, the concept word that is in arelationship analogous to the directional relationship from a concept‘king’ would be ‘queen.’ Two directional vectors are said to be equal ifthe vectors have the same magnitude and the same direction. Thesocial-networking system 1860 may identify a first directional vectorfrom a point represented by a word vector corresponding to ‘man’ toanother point represented by a word vector corresponding to ‘woman’ inthe embedding space 1900. If the social-networking system 1860 canidentify a destination point of a directional vector from a pointrepresented by a word vector corresponding to ‘king’ that makes thedirectional vector equal to the first directional vector, a vectorrepresenting the destination point may correspond to ‘queen.’ Inparticular embodiments, the request may comprise one or more conditionscharacterizing an audience. In such a case, the social-networking system1860 may train the word embedding model with a corpus of text collectedfrom content objects created by a group of users who satisfy the one ormore conditions. As an example and not by way of limitation, asupermarket company may want to understand why people want to have astaycation. The company may already know that people travel for anadventure. Thus, the company may send a request to the social-networkingsystem 1860 to find out a concept that is in an analogous relationshipfrom ‘staycation’ to a relationship from ‘travel’ to ‘adventure.’Although this disclosure describes receiving a request to identify aconcept in a particular relationship from a particular concept in aparticular manner, this disclosure contemplates receiving a request toidentify a concept in a particular relationship from a particularconcept in any suitable manner.

FIG. 8 illustrates an example of an analogy completion in the embeddingspace. In particular embodiments, the social-networking system 1860 mayaccess a table of word vector relationships 101. The social-networkingsystem 1860 may look up a particular word vector 801 corresponding tothe particular n-gram, a first reference word vector 802 correspondingto the first reference n-gram, and a second reference word vector 803corresponding to the second reference n-gram by looking up theparticular n-gram, the first reference n-gram, and the second referencen-gram in the table 101. The social-networking system 1860 may determinean target vector 804 such that a first directional vector from a pointrepresented by the first reference word vector 802 to a pointrepresented by the second reference word vector 803 is equal to a seconddirectional vector from a point represented by the particular wordvector 801 to a point represented by the target vector 804. The firstdirectional vector and the second directional vector are said to beequal if the vectors have the same magnitude and the same direction. Thesocial-networking system 1860 may compute the target vector 804 byadding the second reference vector 803 to the particular word vector 801and subtracting the first reference vector 802 from the particular wordvector 801. Although this disclosure describes identifying an targetvector for an analogy completion in a particular manner, this disclosurecontemplates identifying an target vector for an analogy completion inany suitable manner.

The table 101 may not have an exactly corresponding n-gram for thetarget vector. Thus, the social-networking system 1860 may need to findan n-gram approximating the target concept. In particular embodiments,the social-networking system 1860 may, for each n-gram in the table 101,calculate a similarity metric to the target vector. Thesocial-networking system 1860 may select a target word vector closest tothe target vector in the embedding space 1900 based on the calculatedsimilarity metrics. In particular embodiments, the similarity metric isa cosine similarity. In particular embodiments, the similarity metric isa Euclidean distance. In particular embodiments, the similarity metricis a Jaccard similarity coefficient. The social-networking system 1860may identify a target n-gram corresponding to the target word vector bylooking up the target word vector in the table. In particularembodiments, the social-networking system 1860 may select k word vectorsclosest to the target vector. The social-networking system 1860 mayidentify target n-grams corresponding to the selected k word vectors bylooking up the selected k word vectors in the table. As an example andnot by way of limitation, continuing with the prior example, thesocial-networking system 1860 may identify ‘impromptu,’ ‘excursion,’‘oasis,’ and ‘luau’ as four n-grams closest to the target concept thatis in an analogous relationship from ‘staycation’ to a relationship from‘travel’ to ‘adventure.’ Although this disclosure describes identifyingan n-gram approximating the target concept in an analogy completion in aparticular manner, this disclosure contemplates identifying an n-gramapproximating the target concept in an analogy completion in anysuitable manner.

The social-networking system 1860 may send a response message comprisingthe target n-gram. As an example and not by way of limitation,continuing with the prior example, the social-networking system 1860 maysend a response with ‘impromptu,’ ‘excursion,’ ‘oasis,’ and ‘luau’ asfour n-grams closest to the target concept that is in an analogousrelationship from ‘staycation’ to a relationship from ‘travel’ to‘adventure.’ Based on the n-grams approximating the target concept thatis in an analogous relationship from ‘staycation’ to a relationship from‘travel’ to ‘adventure,’ the supermarket company may send out an ad that“have a staycation on this mothers-day in an impromptu intimate way.”The super market may also send out an ad that “here are things you canbuy for a luau.” Although this disclosure describes sending a responsemessage comprising the target n-gram in a particular manner, thisdisclosure contemplates sending a response message comprising the targetn-gram in any suitable manner.

FIG. 9 illustrates an example method 900 for performing an analogycompletion based on word embeddings on receiving a request. The methodmay begin at step 910, where the social-networking system 1860 mayreceive a request to identify a word representing a target concept thatis in a first relationship with a particular concept based on that afirst reference concept is in a second relationship with a secondreference concept, the first relationship being analogous to the secondrelationship, wherein the request comprises a particular n-gramrepresenting the particular concept, a first reference n-gramrepresenting the first reference concept, and a second reference n-gramrepresenting the second reference concept. At step 920, thesocial-networking system 1860 may access a table of word vectorrelationships, wherein the table comprises a plurality of unique n-gramsand their corresponding word vectors, wherein each of the word vectorsrepresents a semantic context of a corresponding n-gram as a point in ad-dimensional embedding space. At step 930, the social-networking system1860 may look up, using the table, a particular word vectorcorresponding to the particular n-gram, a first reference word vectorcorresponding to the first reference n-gram, and a second reference wordvector corresponding to the second reference n-gram. At step 940, thesocial-networking system 1860 may determine an target vector such that afirst directional vector from a point represented by the first referenceword vector to a point represented by the second reference word vectoris equal to a second directional vector from a point represented by thetarget vector to a point represented by the particular word vector,wherein the first directional vector and the second directional vectorare equal if the vectors have the same magnitude and the same direction.At step 950, the social-networking system 1860 may select, using thetable and based on a similarity metric, a target word vector closest tothe target vector. At step 960, the social-networking system 1860 mayidentify a target n-gram corresponding to the target word vector bylooking up the target word vector in the table. At step 970, thesocial-networking system 1860 may send a response message comprising thetarget n-gram. Particular embodiments may repeat one or more steps ofthe method of FIG. 9, where appropriate. Although this disclosuredescribes and illustrates particular steps of the method of FIG. 9 asoccurring in a particular order, this disclosure contemplates anysuitable steps of the method of FIG. 9 occurring in any suitable order.Moreover, although this disclosure describes and illustrates an examplemethod for performing an analogy completion based on word embeddings onreceiving a request including the particular steps of the method of FIG.9, this disclosure contemplates any suitable method for performing ananalogy completion based on word embeddings on receiving a requestincluding any suitable steps, which may include all, some, or none ofthe steps of the method of FIG. 9, where appropriate. Furthermore,although this disclosure describes and illustrates particularcomponents, devices, or systems carrying out particular steps of themethod of FIG. 9, this disclosure contemplates any suitable combinationof any suitable components, devices, or systems carrying out anysuitable steps of the method of FIG. 9.

Semantic Clustering

In particular embodiments, the social-networking system 1860 may receivea request to generate a visualization of public sentiments regarding aparticular subject by a plurality of clusters. Each cluster may comprisea plurality of words semantically close to each other. The request maycomprise an input n-gram representing the particular subject. Inparticular embodiments, the request may comprise one or more conditionscharacterizing an audience. In such a case, the social-networking system1860 may train the word embedding model with a corpus of text collectedfrom content objects created by a group of users who satisfy the one ormore conditions. The social-networking system 1860 may construct a firstcorpus of text by collecting text containing the input n-gram from aplurality of user-created content objects in the online social network.In case the request comprises one or more conditions characterizing anaudience, the social-networking system 1860 may construct the firstcorpus of text by collecting text containing the input n-gram from aplurality of content-objects in the online social network created byusers that satisfy the one or more conditions. The social-networkingsystem 1860 may identify a list of unique n-grams appearing in the firstcorpus of text. The social-networking system 1860 may generate a firsttable comprising unique n-grams in the list and their corresponding wordvectors using a word embedding model. The social-networking system 1860may classify word vectors in the table into a plurality of clustersbased on semantic similarities of the word vectors by performing ahierarchical clustering on the word vectors in the first table. Thesocial-networking system 1860 may determine a Term Frequency-InverseDocument Frequency (TF-IDF) score for each n-gram in the first table.The social-networking system 1860 may send instructions to displayn-grams in the table on a two-dimensional display space. Theinstructions may include instructions to display n-grams correspondingto word vectors that belong to a same cluster together. In particularembodiments, the instructions may include instructions to adjust a fontsize for an n-gram based at least on a respective TF-IDF score assignedto the n-gram. In particular embodiments, the instructions may includeinstructions to assign a font color for n-grams in a semantic cluster.If the social-networking system 1860 determines that the number ofclusters exceeds a threshold, the instructions may include instructionsto display the most relevant k clusters to the particular subject. Inparticular embodiments, the social-networking system 1860 may identifythe most relevant k clusters to the particular subject by calculating anaverage TD-IDF score for the cluster by taking an average of determinedTD-IDF scores for n-grams corresponding to word vectors that belong tothe cluster for each cluster in the plurality of clusters, and selectingk clusters with highest average TD-IDF scores from the plurality ofclusters. In particular embodiments, the social-networking system 1860may identify the most relevant k clusters to the particular subject bydetermining a maximum TD-IDF score for the cluster by comparingdetermined TD-IDF scores for n-grams corresponding to word vectors thatbelong to the cluster for each cluster in the plurality of clusters, andselecting k clusters with highest maximum TD-IDF scores from theplurality of clusters. Although this disclosure describes visualizingpublic sentiments regarding a particular subject in a particular manner,this disclosure contemplates visualizing public sentiments regarding aparticular subject in any suitable manner.

In particular embodiments, the social-networking system 1860 may receivea request to generate a visualization of public sentiments regarding aparticular subject by a plurality of clusters. The online social networkmay have a large corpus of text collected from content objects generatedby users. Because the number of users generating the content objects maybe large and the users may be well distributed in terms of demographics,the corpus of text may represent contemporary public sentiments. Athird-party user may want to understand public sentiments around aparticular subject. A clustered visualization of keywords representingpublic sentiments may be an intuitive tool for the third-party user tounderstand public sentiments. The third-party user may send the requestto the social-networking system 1860 to generate a clusteredvisualization of keywords representing public sentiments regarding theparticular subject. Each cluster may comprise a plurality of wordssemantically close to each other. The request may comprise an inputn-gram representing the particular subject. In particular embodiments,the request may comprise one or more conditions characterizing anaudience. In such a case, the social-networking system 1860 may trainthe word embedding model with a corpus of text collected from contentobjects created by a group of users who satisfy the one or moreconditions. As an example and not by way of limitation, a third-partyuser may be studying public insights about ‘pregnancy.’ The third-partyuser may want to see keywords representing public sentiments regarding‘pregnancy’ in a clustered way, where each cluster includes keywordssemantically close to each other. The third-party user may send arequest to the social-networking system 1860 to generate a clusteredvisualization of keywords representing public sentiments regarding‘pregnancy.’ Although this disclosure describes receiving a request togenerate a clustered visualization of keywords related to a particularsubject in a particular manner, this disclosure contemplates receiving arequest to generate a clustered visualization of keywords related to aparticular subject in any suitable manner.

In particular embodiments, the social-networking system 1860 mayconstruct a first corpus of text by collecting text containing the inputn-gram from a plurality of user-created content objects in the onlinesocial network. In case the request comprises one or more conditionscharacterizing an audience, the social-networking system 1860 mayconstruct the first corpus of text by collecting text containing theinput n-gram from a plurality of content-objects in the online socialnetwork created by users that satisfy the one or more conditions. Thesocial-networking system 1860 may identify a list of unique n-gramsappearing in the first corpus of text. The social-networking system 1860may generate a first table comprising unique n-grams in the list andtheir corresponding word vectors using a word embedding model. Thesocial-networking system 1860 may classify word vectors in the firsttable into a plurality of clusters based on semantic similarities of theword vectors by performing a hierarchical clustering on the word vectorsin the first table. Hierarchical clustering is a method of clusteranalysis that seeks to build a hierarchy of clusters. Two alternativeapproaches may be available for hierarchical clustering: In anagglomerative approach, each word vectors may start in its own cluster.Pairs of clusters may be merged. In a divisive approach, all the wordvectors may start in one cluster. Splitting the cluster may be performedrecursively. To decide which clusters should be combined, or where acluster should be split, a measure of dissimilarity between sets of wordvectors is required. A similarity metric may be used for the decision.The social-networking system 1860 may classify word vectors in the firsttable into a plurality of clusters based on semantic similarities of theword vectors by performing any other suitable algorithms. Thesocial-networking system 1860 may determine a Term Frequency-InverseDocument Frequency (TF-IDF) score for each n-gram in the first table.TF-IDF is a way to score the importance of n-grams in a document basedon how frequently the n-grams appear across multiple documents. If ann-gram appears frequently in a document, the n-gram may be an importantone. The social-networking system 1860 may assign a high score to then-gram. However, some n-grams (e.g., the, is, a, that) may appearfrequently in many documents. The social-networking system 1860 maylower the score for those n-grams as those n-grams are not unique.Although this disclosure describes classifying word vectors intoclusters in a particular manner, this disclosure contemplatesclassifying word vectors into clusters in any suitable manner.

In particular embodiments, the social-networking system 1860 may sendinstructions to display n-grams in the first table in a two-dimensionaldisplay space. The instructions may include instructions to displayn-grams corresponding to word vectors that belong to a same clustertogether. In particular embodiments, the instructions may includeinstructions to adjust a font size for an n-gram based at least on arespective TF-IDF score assigned to the n-gram. In particularembodiments, the instructions may include instructions to assign a fontcolor for n-grams in a semantic cluster. If the social-networking system1860 determines that a number of clusters exceeds a threshold, theinstructions may include instructions to display the most relevant kclusters to the particular subject. In particular embodiments, thesocial-networking system 1860 may identify the most relevant k clustersto the particular subject by calculating an average TD-IDF score for thecluster by taking an average of determined TD-IDF scores for n-gramscorresponding to word vectors that belong to the cluster for eachcluster in the plurality of clusters, and selecting k clusters withhighest average TD-IDF scores from the plurality of clusters. Inparticular embodiments, the social-networking system 1860 may identifythe most relevant k clusters to the particular subject by determining amaximum TD-IDF score for the cluster by comparing determined TD-IDFscores for n-grams corresponding to word vectors that belong to thecluster for each cluster in the plurality of clusters, and selecting kclusters with highest maximum TD-IDF scores from the plurality ofclusters. FIG. 10 illustrates an example visualization of publicsentiments for a particular subject in a plurality of clusters. As anexample and not by way of limitation, continuing with the prior example,the social-networking system 1860 may, in response to the request, sendinstructions to display n-grams that are closely related to ‘pregnancy’in a two-dimensional display space in a clustered way, where eachcluster includes n-grams that are semantically close to each other. Theinstructions may include instructions to display the most relevant kclusters to ‘pregnancy.’ The instructions may include instructions toassign a font color for a cluster. The instructions may includeinstructions to adjust a font size for an n-gram based on the calculatedTF-IDF score for the n-gram. Although this disclosure describesdisplaying n-grams in a plurality of clusters in a particular manner,this disclosure contemplates displaying n-grams in a plurality ofclusters in any suitable manner.

FIG. 11 illustrates an example method 1100 for visualizing publicsentiments for a particular subject in a plurality of clusters. Themethod may begin at step 1110, where the social-networking system 1860may receive a request to generate a visualization of public sentimentsregarding a particular subject by a plurality of clusters, wherein eachcluster comprises a plurality of words semantically close to each other,and wherein the request comprises an input n-gram representing theparticular subject. At step 1120, the social-networking system 1860 mayconstruct a first corpus of text by collecting text containing the inputn-gram from a plurality of user-created content objects in the onlinesocial network. At step 1130, the social-networking system 1860 mayidentify a list of unique n-grams appearing in the first corpus of text.At step 1140, the social-networking system 1860 may generate, using aword embedding model, a table comprising unique n-grams in the list andtheir corresponding word vectors, wherein the word embedding model wastrained using a second corpus of text collected from a plurality ofuser-created content objects in the online social network as trainingdata, wherein each of the word vectors represents a semantic context ofa corresponding n-gram as a point in a d-dimensional embedding space. Atstep 1150, the social-networking system 1860 may classify word vectorsin the table into a plurality of clusters based on semantic similaritiesof the word vectors. At step 1160, the social-networking system 1860 maysend, as a response to the request, instructions to display n-grams inthe table in a two-dimensional display space, wherein n-gramscorresponding to word vectors that belong to the same cluster aredisplayed together. Particular embodiments may repeat one or more stepsof the method of FIG. 11, where appropriate. Although this disclosuredescribes and illustrates particular steps of the method of FIG. 11 asoccurring in a particular order, this disclosure contemplates anysuitable steps of the method of FIG. 11 occurring in any suitable order.Moreover, although this disclosure describes and illustrates an examplemethod for visualizing public sentiments for a particular subject in aplurality of clusters including the particular steps of the method ofFIG. 11, this disclosure contemplates any suitable method forvisualizing public sentiments for a particular subject in a plurality ofclusters including any suitable steps, which may include all, some, ornone of the steps of the method of FIG. 11, where appropriate.Furthermore, although this disclosure describes and illustratesparticular components, devices, or systems carrying out particular stepsof the method of FIG. 11, this disclosure contemplates any suitablecombination of any suitable components, devices, or systems carrying outany suitable steps of the method of FIG. 11.

Word Paths

In particular embodiments, the social-networking system 1860 may receivea request to identify k steps for a particular entity to acquire atarget attribute in public sentiments from a computing device. Therequest may include an entity name for the particular entity and ann-gram representing the target attribute. In particular embodiments, therequest may comprise one or more conditions characterizing an audience.In such a case, the social-networking system 1860 may train the wordembedding model with a corpus of text collected from content objectscreated by a group of users who satisfy the one or more conditions. Thesocial-networking system 1860 may access the table of word vectorrelationships 101. The social-networking system 1860 may look up anentity word vector corresponding to the entity name and a targetattribute word vector corresponding to the n-gram that represents thetarget attribute by looking up the entity name and the n-gramrepresenting the target attribute in the table 101. Thesocial-networking system 1860 may determine a directional vector in thed-dimensional embedding space 1900 that connects from a pointrepresented by the entity word vector to a point represented by thetarget attribute word vector. The social-networking system 1860 mayidentify k points on the directional vector that evenly split thedirectional vector into k+1 segments. The social-networking system 1860may, for each n-gram in the table 101, calculate a similarity metric toeach of the identified k points. The social-networking system 1860 mayselect, for each of the k points, a word vector that is closest to thepoint in the embedding space 1900 based on the calculated similaritymetrics. In particular embodiments, the similarity metric is a cosinesimilarity. In particular embodiments, the similarity metric is aEuclidean distance. In particular embodiments, the similarity metric isa Jaccard similarity coefficient. The social-networking system 1860 mayidentify a corresponding n-gram for each of the k selected word vectorsby looking up the word vector in the table. The social-networking system1860 may send a response message comprising the k identified n-grams tothe computing device. Although this disclosure describes identifying ksteps for an entity to achieve a particular attribute in a particularmanner, this disclosure contemplates identifying k steps for an entityto achieve a particular attribute in any suitable manner.

In particular embodiments, the social-networking system 1860 may receivea request to identify k steps for a particular entity to acquire atarget attribute in public sentiments from a computing device. Therequest may include an entity name for the particular entity and ann-gram representing the target attribute. Semantically close n-grams maybe represented by word vectors close to each other in the embeddingspace 1900. If a first word vector corresponding to an entity name isclose to a second word vector corresponding to a quality or an attributeof an entity (e.g., creative, intelligent, innovative), the entity maybe perceived by public as possessing the quality represented by thesecond word vector. For example, if a word vector corresponding to anonline social network provider is close to a word vector correspondingto ‘innovative’ in the embedding space 1900, the social network providermay be considered as being innovative by the public. A word embeddingcorresponding to a name of an entity may not be close to a desiredquality or attribute. A third-party user associated with the computingdevice may want to identify a way for the entity to be considered havingthe desired attribute by the public. A number of attributes locatedbetween the entity name and the desired attribute in the embedding space1900 may provide a hint for the entity to acquire the desired attribute.The third-party user may send a request to the social-networking system1860 to identify k attributes located along a path from the entity tothe desired attribute in the embedding space. In particular embodiments,the request may comprise one or more conditions characterizing anaudience. In such a case, the social-networking system 1860 may trainthe word embedding model with a corpus of text collected from contentobjects created by a group of users who satisfy the one or moreconditions. As an example and not by way of limitation, a globalsoftware company may want to increase its perception as innovative. Athird-party user at the global software company may send a request to anonline social network to identify k attributes located along a path fromthe company name to ‘innovative’ in the embedding space 1900. Althoughthis disclosure describes receiving a request to identify k attributeslocated along a path from a particular entity to an attribute in theembedding space in a particular manner, this disclosure contemplatesreceiving a request to identify k attributes located along a path from aparticular entity to an attribute in the embedding space in any suitablemanner.

FIG. 12 illustrates an example of identifying k steps from an entityvector to a target attribute vector in the embedding space. Inparticular embodiments, the social-networking system 1860 may access thetable of word vector relationships 101. The social-networking system1860 may look up an entity word vector 1201 corresponding to the entityname and a target attribute word vector 1202 corresponding to the n-gramrepresenting the target attribute by looking up the entity name and then-gram representing the target attribute in the table 101. Thesocial-networking system 1860 may determine a directional vector in thed-dimensional embedding space 1900 that connects from a pointrepresented by the entity word vector 1201 to a point represented by thetarget attribute word vector 1202. The social-networking system 1860 mayidentify k points on the directional vector that evenly split thedirectional vector into k+1 segments. In the example illustrated in FIG.12, the social-networking system 1860 may have identified four points1203, 1204, 1205, and 1206 on the directional vector. Thesocial-networking system 1860 may, for each n-gram in the table 101,calculate a similarity metric to each of the identified k points. Thesocial-networking system 1860 may select, for each of the k points, aword vector that is closest to the point in the embedding space 1900based on the calculated similarity metrics. In the example illustratedin FIG. 12, the social-networking system 1860 may have selected fourword vectors 1210, 1220, 1230, and 1240 that are closest to points 1202,1203, 1204, and 1205, respectively. In particular embodiments, thesimilarity metric is a cosine similarity. In particular embodiments, thesimilarity metric is a Euclidean distance. In particular embodiments,the similarity metric is a Jaccard similarity coefficient. Thesocial-networking system 1860 may identify a corresponding n-gram foreach of the k selected word vectors by looking up the word vector in thetable. Although this disclosure describes identifying k n-grams alongthe path from the entity name to the desired attribute in the embeddingspace in a particular manner, this disclosure contemplates identifying kn-grams along the path from the entity name to the desired attribute inthe embedding space in any suitable manner.

The social-networking system 1860 may send a response message comprisingthe k identified n-grams to the computing device. As an example and notby way of limitation, continuing with the prior example, thesocial-networking system 1860 may send a message including ‘software,’‘funding,’ ‘proposal,’ ‘industry,’ ‘development,’ ‘nation,’ ‘education,’and ‘fund’ in an order of distance from the company name. Based on theidentified n-grams on the path, the third-party user may determine thatthe global software company may need to focus on internationaldevelopment and educational funding rather than trying to keep softwareinnovator position in order to increase public perception on the companyas innovative. Although this disclosure describes sending a responseincluding k identified n-grams in a particular manner, this disclosurecontemplates sending a response including k identified n-grams in anysuitable manner.

FIG. 13 illustrates an example method 1300 for identifying k steps for aparticular entity to acquire a target attribute on receiving a request.The method may begin at step 1310, where the social-networking system1860 may receive, from a second computing device, a request to identifyk steps for a particular entity to acquire a target attribute in publicsentiments, wherein the request comprises an entity name for theparticular entity and an n-gram representing the target attribute. Atstep 1320, the social-networking system 1860 may access a table of wordvector relationships, wherein the table of word vector relationshipscomprises a plurality of unique n-grams and their corresponding wordvectors, wherein each of the word vectors represents a semantic contextof a corresponding n-gram as a point in a d-dimensional embedding space.At step 1330, the social-networking system 1860 may look up, using thetable, an entity word vector corresponding to the entity name and atarget attribute word vector corresponding to the n-gram representingthe target attribute. At step 1340, the social-networking system 1860may determine a directional vector in the d-dimensional embedding spacethat connects from a point represented by the entity word vector to apoint represented by the target attribute word vector. At step 1350, thesocial-networking system 1860 may identify k points on the directionalvector that evenly split the directional vector into k+1 segments. Atstep 1360, the social-networking system 1860 may select, for each of thek points, using the table and based on a similarity metric, a wordvector that is closest to the point. At step 1370, the social-networkingsystem 1860 may identify, for each of the k selected word vectors, acorresponding n-gram by looking up the word vector in the table. At step1380, the social-networking system 1860 may send, to the secondcomputing device, a response message comprising the k identifiedn-grams. Particular embodiments may repeat one or more steps of themethod of FIG. 13, where appropriate. Although this disclosure describesand illustrates particular steps of the method of FIG. 13 as occurringin a particular order, this disclosure contemplates any suitable stepsof the method of FIG. 13 occurring in any suitable order. Moreover,although this disclosure describes and illustrates an example method foridentifying k steps for a particular entity to acquire a targetattribute on receiving a request including the particular steps of themethod of FIG. 13, this disclosure contemplates any suitable method foridentifying k steps for a particular entity to acquire a targetattribute on receiving a request including any suitable steps, which mayinclude all, some, or none of the steps of the method of FIG. 13, whereappropriate. Furthermore, although this disclosure describes andillustrates particular components, devices, or systems carrying outparticular steps of the method of FIG. 13, this disclosure contemplatesany suitable combination of any suitable components, devices, or systemscarrying out any suitable steps of the method of FIG. 13.

Brand Attribute Mapping

In particular embodiments, the social-networking system 1860 may receivea request to identify public sentiments for one or more entities from acomputing device. The request may include names of the one or moreentities and a plurality of attribute n-grams representing a pluralityof pre-determined attributes. In particular embodiments, the request maycomprise one or more conditions characterizing an audience. In such acase, the social-networking system 1860 may train the word embeddingmodel with a corpus of text collected from content objects created by agroup of users who satisfy the one or more conditions. Thesocial-networking system 1860 may access a table of word vectorrelationships. The social-networking system 1860 may look up entity wordvectors corresponding to each of the names of the one or more entitiesand attribute word vectors corresponding to each of the plurality ofattribute n-grams by looking up each of the names of the one or moreentities and each of the plurality of attribute n-grams in the table.For each of the entity word vectors, the social-networking system 1860may calculate a similarity metric to each of the attribute word vectorsin the embedding space 1900. In particular embodiments, the similaritymetric is a cosine similarity. In particular embodiments, the similaritymetric is a Euclidean distance. In particular embodiments, thesimilarity metric is a Jaccard similarity coefficient. Thesocial-networking system 1860 may send a response message to thecomputing device. The response message may include calculated similaritymetrics corresponding to all the pairs of an entity word vector and anattribute word vector. In particular embodiments, the response messagemay include instructions to display the calculated similarity metrics.The calculated similarity metrics may be color-coded where a color mayrepresent any number within a pre-determined range. Although thisdisclosure describes identifying public sentiments for one or moreentities in a particular manner, this disclosure contemplatesidentifying public sentiments for one or more entities in any suitablemanner.

In particular embodiments, the social-networking system 1860 may receivea request to identify public sentiments for one or more entities from acomputing device. The request may include names of the one or moreentities and a plurality of attribute n-grams representing a pluralityof pre-determined attributes. Semantically close n-grams may berepresented by word vectors close to each other in the embedding space1900. If a first word vector corresponding to an entity name is close toa second word vector corresponding to a quality or an attribute (e.g.,creative, intelligent, innovative) of an entity, the entity may beperceived by the public as possessing the quality corresponding to thesecond word vector. The first word vector corresponding to the entityname may not be close to a third word vector corresponding to anotherattribute. In such a case, the entity may not be perceived by the publicas possessing the attribute corresponding to the third word vector. Athird-party user associated with the computing device may want toevaluate public perceptions for one or more entities. The third-partyuser may send a request to identify public perceptions for one or moreentities. The request may include names of one or more entities andattribute n-grams representing a plurality of pre-determined attributes.In particular embodiments, the request may comprise one or moreconditions characterizing an audience. In such a case, thesocial-networking system 1860 may train the word embedding model with acorpus of text collected from content objects created by a group ofusers who satisfy the one or more conditions. As an example and not byway of limitation, a third-party use may want to evaluate publicperceptions for a plurality of companies including 1420, 1430, 1440,1450, 1460, 1470, and 1480. The third-party user may prepare a pluralityof pre-determined attributes for the companies including ‘necessary’1401, ‘intelligent’ 1402, ‘important’ 1403, ‘helpful’ 1404, ‘fun’ 1405,‘delicious’ 1406, ‘creative’ 1407, ‘confident’ 1408, ‘cheap’ 1409,‘beautiful’ 1410, and ‘authentic’ 1411. The third-party user may send arequest to the social-networking system 1860 to identify closenessbetween the companies and the attributes in public sentiments. Althoughthis disclosure describes receiving a request to identify closenessbetween entities and attributes in a particular manner, this disclosurecontemplates receiving a request to identify closeness between entitiesand attributes in any suitable manner.

In particular embodiments, the social-networking system 1860 may accessa table of word vector relationships. The social-networking system 1860may look up entity word vectors corresponding to each of the names ofthe one or more entities and attribute word vectors corresponding toeach of the plurality of attribute n-grams by looking up each of thenames of the one or more entities and each of the plurality of attributen-grams in the table. For each of the entity word vectors, thesocial-networking system 1860 may calculate a similarity metric to eachof the attribute word vectors in the embedding space 1900. In particularembodiments, the similarity metric is a cosine similarity. In particularembodiments, the similarity metric is a Euclidean distance. Inparticular embodiments, the similarity metric is a Jaccard similaritycoefficient. Although this disclosure describes calculating a similaritymetric of each of the entity word vectors to each of the attribute wordvectors in a particular manner, this disclosure contemplates calculatinga similarity metric of each of the entity word vectors to each of theattribute word vectors in any suitable manner.

In particular embodiments, the social-networking system 1860 may send aresponse message to the computing device. The response message mayinclude calculated similarity metrics corresponding to all the pairs ofan entity word vector and an attribute word vector. In particularembodiments, the response message may include instructions to displaythe calculated similarity metrics. The calculated similarity metrics maybe color-coded where a color may represent any number within apre-determined range. The calculated similarity metrics may bepattern-coded where a pattern may represent any number within apre-determined range. The calculated similarity metrics may becolor-pattern-coded where a combination of a color and a pattern mayrepresent any number within a pre-determined range. FIG. 14 illustratesan example similarity metrics between entities and attributes. In theexample illustrated in FIG. 14, the similarity metrics arecolor-pattern-coded. As an example and not by way of limitation,continuing with the prior example, the social-networking system 1860 maycalculate a similarity metric for each of the companies (1420, 1430,1440, 1450, 1460, 1470, and 1480) to each of the pre-determinedattributes (‘necessary’ 1401, ‘intelligent’ 1402, ‘important’ 1403,‘helpful’ 1404, ‘fun’ 1405, ‘delicious’ 1406, ‘creative’ 1407,‘confident’ 1408, ‘cheap’ 1409, ‘beautiful’ 1410, and ‘authentic’ 1411).The social-networking system 1860 may send a response message includingsimilarity metrics corresponding to all the pairs of an entity wordvector and an attribute word vector. The response message may includeinstructions to display the calculated similarity metrics incolor-pattern-codes. Although this disclosure describes displayingsimilarity metrics corresponding to all the pairs of an entity and anattribute in a particular manner, this disclosure contemplatessimilarity metrics corresponding to all the pairs of an entity and anattribute in any suitable manner.

FIG. 15 illustrates an example method 1500 for identifying publicsentiments for one or more entities on receiving a request. The methodmay begin at step 1510, where the social-networking system 1860 mayreceive, from a second computing device, a request to identify publicsentiments for one or more entities, wherein the request comprises namesof the one or more entities and a plurality of attribute n-grams,wherein each of the attribute n-grams represents an attribute among aplurality of pre-determined attributes. At step 1520, thesocial-networking system 1860 may access a table of word vectorrelationships, wherein the table of word vector relationships comprisesa plurality of unique n-grams and their corresponding word vectors,wherein each of the word vectors represents a semantic context of acorresponding n-gram as a point in a d-dimensional embedding space. Atstep 1530, the social-networking system 1860 may look up, using thetable, entity word vectors corresponding to each of the names for theone or more entities and attribute word vectors corresponding to each ofthe plurality of attribute n-grams. At step 1540, the social-networkingsystem 1860 may calculate, for each of the entity word vectors, asimilarity metric to each of the attribute word vectors. At step 1550,the social-networking system 1860 may send, to the second computingdevice, a response message, wherein the response message comprisescalculated similarity metrics corresponding to all the pairs of anentity word vector and an attribute word vector. Particular embodimentsmay repeat one or more steps of the method of FIG. 15, whereappropriate. Although this disclosure describes and illustratesparticular steps of the method of FIG. 15 as occurring in a particularorder, this disclosure contemplates any suitable steps of the method ofFIG. 15 occurring in any suitable order. Moreover, although thisdisclosure describes and illustrates an example method for identifyingpublic sentiments for one or more entities on receiving a requestincluding the particular steps of the method of FIG. 15, this disclosurecontemplates any suitable method for identifying public sentiments forone or more entities on receiving a request including any suitablesteps, which may include all, some, or none of the steps of the methodof FIG. 15, where appropriate. Furthermore, although this disclosuredescribes and illustrates particular components, devices, or systemscarrying out particular steps of the method of FIG. 15, this disclosurecontemplates any suitable combination of any suitable components,devices, or systems carrying out any suitable steps of the method ofFIG. 15.

Brand Perception Overlap

In particular embodiments, the social-networking system 1860 may receivea request to identify a similarity in public sentiments for each pairfrom a plurality of entities from a second computing device. The requestmay include names of the plurality of entities. In particularembodiments, the request may comprise one or more conditionscharacterizing an audience. In such a case, the social-networking system1860 may train the word embedding model with a corpus of text collectedfrom content objects created by a group of users who satisfy the one ormore conditions. The social-networking system 1860 may access a table ofword vector relationships. The social-networking system 1860 may look upword vectors corresponding to each of the names by looking up each ofthe names. For each of the word vectors, the social-networking system1860 may calculate a similarity metric to each of the word vectors inthe embedding space 1900. In particular embodiments, the similaritymetric is a cosine similarity. In particular embodiments, the similaritymetric is a Euclidean distance. In particular embodiments, thesimilarity metric is a Jaccard similarity coefficient. Thesocial-networking system 1860 may send a response message to thecomputing device. The response message may include calculated similaritymetrics corresponding to all the pairs of the word vectors. Inparticular embodiments, the response message may include instructions todisplay the calculated similarity metrics. The calculated similaritymetrics may be color-coded where a color may represent any number withina pre-determined range. Although this disclosure describes identifying asimilarity in public sentiments for each pair from a plurality ofentities in a particular manner, this disclosure contemplatesidentifying a similarity in public sentiments for each pair from aplurality of entities in any suitable manner.

In particular embodiments, the social-networking system 1860 may receivea request to identify a similarity in public sentiments for each pairfrom a plurality of entities from a second computing device. The requestmay include names of the plurality of entities. Semantically closen-grams may be represented by word vectors close to each other in theembedding space 1900. If word vectors corresponding to two entity namesare close to each other in the embedding space 1900, the two entitiesmay be viewed similarly by the public. Two entities whose correspondingword vectors are far from each other in the embedding space 1900 may beviewed differently by the public. A third-party user associated with thecomputing device may want to understand how close a number of entitiesare perceived by the public to each other. The third-party user may senda request to the social-networking system 1860 to identify similaritymetrics between entities. The request may include a list of entitynames. In particular embodiments, the request may comprise one or moreconditions characterizing an audience. In such a case, thesocial-networking system 1860 may train the word embedding model with acorpus of text collected from content objects created by a group ofusers who satisfy the one or more conditions. As an example and not byway of limitation, a third-party user may want to understand how close alist of beer brands are perceived by consumers. The third-party user maysend a request to the social-networking system 1860 to calculatesimilarity metrics for each pair of beer brands in the embedding space1900. The request may include a list of beer brands: 1601, 1602, 1603,1604, 1605, and 1606. Although this disclosure describes receiving arequest to calculate similarity metrics between entities in theembedding space 1900 in a particular manner, this disclosurecontemplates receiving a request to calculate similarity metrics betweenentities in the embedding space 1900 in any suitable manner.

In particular embodiments, the social-networking system 1860 may accessa table of word vector relationships. The social-networking system 1860may look up word vectors corresponding to each of the names by lookingup each of the names. For each of the word vectors, thesocial-networking system 1860 may calculate a similarity metric to eachof the word vectors in the embedding space 1900. In particularembodiments, the similarity metric is a cosine similarity. In particularembodiments, the similarity metric is a Euclidean distance. Inparticular embodiments, the similarity metric is a Jaccard similaritycoefficient. Although this disclosure describes calculating a similaritymetric for each pair of word vectors in a particular manner, thisdisclosure contemplates calculating a similarity metric for each pair ofword vectors in any suitable manner.

In particular embodiments, the social-networking system 1860 may send aresponse message to the computing device. The response message mayinclude calculated similarity metrics corresponding to all the pairs ofthe word vectors. In particular embodiments, the response message mayinclude instructions to display the calculated similarity metrics. Thecalculated similarity metrics may be color-coded where a color mayrepresent any number within a pre-determined range. The calculatedsimilarity metrics may be pattern-coded where a pattern may representany number within a pre-determined range. The calculated similaritymetrics may be color-pattern-coded where a combination of a color and apattern may represent any number within a pre-determined range. FIG. 16illustrates an example similarity metrics for each pair of entities. Asan example and not by way of limitation, continuing with the priorexample, the social-networking system 1860 may calculate similaritymetrics for all the pairs of word vectors corresponding to the beerbrands: (1601, 1602, 1603, 1604, 1605, and 1606). The social-networkingsystem 1860 may send a response message including the calculatedsimilarity metrics. The response may include instructions to display thecalculated similarity metrics. Although this disclosure describesdisplaying similarity metrics in a particular manner, this disclosurecontemplates displaying similarity metrics in any suitable manner.

FIG. 17 illustrates an example method 1700 for identifying a similarityin public sentiments for each pair from a plurality of entities. Themethod may begin at step 1710, where the social-networking system 1860may receive, from a second computing device, a request to identify asimilarity in public sentiments for each pair from a plurality ofentities, wherein the request comprises names of the plurality ofentities. At step 1720, the social-networking system 1860 may access atable of word vector relationships, wherein the table of word vectorrelationships comprises a plurality of unique n-grams and theircorresponding word vectors, wherein each of the word vectors representsa semantic context of a corresponding n-gram as a point in ad-dimensional embedding space. At step 1730, the social-networkingsystem 1860 may look up, using the table, word vectors corresponding toeach of the names. At step 1740, the social-networking system 1860 maycalculate, for each of the word vectors, a similarity metric to each ofthe word vectors. At step 1750, the social-networking system 1860 maysend, to the second computing device, a response message, wherein theresponse message comprises calculated similarity metrics correspondingto all the pairs of the word vectors. Particular embodiments may repeatone or more steps of the method of FIG. 17, where appropriate. Althoughthis disclosure describes and illustrates particular steps of the methodof FIG. 17 as occurring in a particular order, this disclosurecontemplates any suitable steps of the method of FIG. 17 occurring inany suitable order. Moreover, although this disclosure describes andillustrates an example method for identifying a similarity in publicsentiments for each pair from a plurality of entities including theparticular steps of the method of FIG. 17, this disclosure contemplatesany suitable method for identifying a similarity in public sentimentsfor each pair from a plurality of entities including any suitable steps,which may include all, some, or none of the steps of the method of FIG.17, where appropriate. Furthermore, although this disclosure describesand illustrates particular components, devices, or systems carrying outparticular steps of the method of FIG. 17, this disclosure contemplatesany suitable combination of any suitable components, devices, or systemscarrying out any suitable steps of the method of FIG. 17.

System Overview

FIG. 18 illustrates an example network environment 1800 associated witha social-networking system. Network environment 1800 includes a clientsystem 1830, a social-networking system 1860, and a third-party system1870 connected to each other by a network 1810. Although FIG. 18illustrates a particular arrangement of client system 1830,social-networking system 1860, third-party system 1870, and network1810, this disclosure contemplates any suitable arrangement of clientsystem 1830, social-networking system 1860, third-party system 1870, andnetwork 1810. As an example and not by way of limitation, two or more ofclient system 1830, social-networking system 1860, and third-partysystem 1870 may be connected to each other directly, bypassing network1810. As another example, two or more of client system 1830,social-networking system 1860, and third-party system 1870 may bephysically or logically co-located with each other in whole or in part.Moreover, although FIG. 18 illustrates a particular number of clientsystems 1830, social-networking systems 1860, third-party systems 1870,and networks 1810, this disclosure contemplates any suitable number ofclient systems 1830, social-networking systems 1860, third-party systems1870, and networks 1810. As an example and not by way of limitation,network environment 1800 may include multiple client system 1830,social-networking systems 1860, third-party systems 1870, and networks1810.

This disclosure contemplates any suitable network 1810. As an exampleand not by way of limitation, one or more portions of network 1810 mayinclude an ad hoc network, an intranet, an extranet, a virtual privatenetwork (VPN), a local area network (LAN), a wireless LAN (WLAN), a widearea network (WAN), a wireless WAN (WWAN), a metropolitan area network(MAN), a portion of the Internet, a portion of the Public SwitchedTelephone Network (PSTN), a cellular telephone network, or a combinationof two or more of these. Network 1810 may include one or more networks1810.

Links 1850 may connect client system 1830, social-networking system1860, and third-party system 1870 to communication network 1810 or toeach other. This disclosure contemplates any suitable links 1850. Inparticular embodiments, one or more links 1850 include one or morewireline (such as for example Digital Subscriber Line (DSL) or Data OverCable Service Interface Specification (DOCSIS)), wireless (such as forexample Wi-Fi or Worldwide Interoperability for Microwave Access(WiMAX)), or optical (such as for example Synchronous Optical Network(SONET) or Synchronous Digital Hierarchy (SDH)) links. In particularembodiments, one or more links 1850 each include an ad hoc network, anintranet, an extranet, a VPN, a LAN, a WLAN, a WAN, a WWAN, a MAN, aportion of the Internet, a portion of the PSTN, a cellulartechnology-based network, a satellite communications technology-basednetwork, another link 1850, or a combination of two or more such links1850. Links 1850 need not necessarily be the same throughout networkenvironment 1800. One or more first links 1850 may differ in one or morerespects from one or more second links 1850.

In particular embodiments, client system 1830 may be an electronicdevice including hardware, software, or embedded logic components or acombination of two or more such components and capable of carrying outthe appropriate functionalities implemented or supported by clientsystem 1830. As an example and not by way of limitation, a client system1830 may include a computer system such as a desktop computer, notebookor laptop computer, netbook, a tablet computer, e-book reader, GPSdevice, camera, personal digital assistant (PDA), handheld electronicdevice, cellular telephone, smartphone, augmented/virtual realitydevice, other suitable electronic device, or any suitable combinationthereof. This disclosure contemplates any suitable client systems 1830.A client system 1830 may enable a network user at client system 1830 toaccess network 1810. A client system 1830 may enable its user tocommunicate with other users at other client systems 1830.

In particular embodiments, client system 1830 may include a web browser1832, such as MICROSOFT INTERNET EXPLORER, GOOGLE CHROME or MOZILLAFIREFOX, and may have one or more add-ons, plug-ins, or otherextensions, such as TOOLBAR or YAHOO TOOLBAR. A user at client system1830 may enter a Uniform Resource Locator (URL) or other addressdirecting the web browser 1832 to a particular server (such as server1862, or a server associated with a third-party system 1870), and theweb browser 1832 may generate a Hyper Text Transfer Protocol (HTTP)request and communicate the HTTP request to server. The server mayaccept the HTTP request and communicate to client system 1830 one ormore Hyper Text Markup Language (HTML) files responsive to the HTTPrequest. Client system 1830 may render a webpage based on the HTML filesfrom the server for presentation to the user. This disclosurecontemplates any suitable webpage files. As an example and not by way oflimitation, webpages may render from HTML files, Extensible Hyper TextMarkup Language (XHTML) files, or Extensible Markup Language (XML)files, according to particular needs. Such pages may also executescripts such as, for example and without limitation, those written inJAVASCRIPT, JAVA, MICROSOFT SILVERLIGHT, combinations of markup languageand scripts such as AJAX (Asynchronous JAVASCRIPT and XML), and thelike. Herein, reference to a webpage encompasses one or morecorresponding webpage files (which a browser may use to render thewebpage) and vice versa, where appropriate.

In particular embodiments, social-networking system 1860 may be anetwork-addressable computing system that can host an online socialnetwork. Social-networking system 1860 may generate, store, receive, andsend social-networking data, such as, for example, user-profile data,concept-profile data, social-graph information, or other suitable datarelated to the online social network. Social-networking system 1860 maybe accessed by the other components of network environment 1800 eitherdirectly or via network 1810. As an example and not by way oflimitation, client system 1830 may access social-networking system 1860using a web browser 1832, or a native application associated withsocial-networking system 1860 (e.g., a mobile social-networkingapplication, a messaging application, another suitable application, orany combination thereof) either directly or via network 1810. Inparticular embodiments, social-networking system 1860 may include one ormore servers 1862. Each server 1862 may be a unitary server or adistributed server spanning multiple computers or multiple datacenters.Servers 1862 may be of various types, such as, for example and withoutlimitation, web server, news server, mail server, message server,advertising server, file server, application server, exchange server,database server, proxy server, another server suitable for performingfunctions or processes described herein, or any combination thereof. Inparticular embodiments, each server 1862 may include hardware, software,or embedded logic components or a combination of two or more suchcomponents for carrying out the appropriate functionalities implementedor supported by server 1862. In particular embodiments,social-networking system 1860 may include one or more data stores 1864.Data stores 1864 may be used to store various types of information. Inparticular embodiments, the information stored in data stores 1864 maybe organized according to specific data structures. In particularembodiments, each data store 1864 may be a relational, columnar,correlation, or other suitable database. Although this disclosuredescribes or illustrates particular types of databases, this disclosurecontemplates any suitable types of databases. Particular embodiments mayprovide interfaces that enable a client system 1830, a social-networkingsystem 1860, or a third-party system 1870 to manage, retrieve, modify,add, or delete, the information stored in data store 1864.

In particular embodiments, social-networking system 1860 may store oneor more social graphs in one or more data stores 1864. In particularembodiments, a social graph may include multiple nodes—which may includemultiple user nodes (each corresponding to a particular user) ormultiple concept nodes (each corresponding to a particular concept)—andmultiple edges connecting the nodes. Social-networking system 1860 mayprovide users of the online social network the ability to communicateand interact with other users. In particular embodiments, users may jointhe online social network via social-networking system 1860 and then addconnections (e.g., relationships) to a number of other users ofsocial-networking system 1860 to whom they want to be connected. Herein,the term “friend” may refer to any other user of social-networkingsystem 1860 with whom a user has formed a connection, association, orrelationship via social-networking system 1860.

In particular embodiments, social-networking system 1860 may provideusers with the ability to take actions on various types of items orobjects, supported by social-networking system 1860. As an example andnot by way of limitation, the items and objects may include groups orsocial networks to which users of social-networking system 1860 maybelong, events or calendar entries in which a user might be interested,computer-based applications that a user may use, transactions that allowusers to buy or sell items via the service, interactions withadvertisements that a user may perform, or other suitable items orobjects. A user may interact with anything that is capable of beingrepresented in social-networking system 1860 or by an external system ofthird-party system 1870, which is separate from social-networking system1860 and coupled to social-networking system 1860 via a network 1810.

In particular embodiments, social-networking system 1860 may be capableof linking a variety of entities. As an example and not by way oflimitation, social-networking system 1860 may enable users to interactwith each other as well as receive content from third-party systems 1870or other entities, or to allow users to interact with these entitiesthrough an application programming interfaces (API) or othercommunication channels.

In particular embodiments, a third-party system 1870 may include one ormore types of servers, one or more data stores, one or more interfaces,including but not limited to APIs, one or more web services, one or morecontent sources, one or more networks, or any other suitable components,e.g., that servers may communicate with. A third-party system 1870 maybe operated by a different entity from an entity operatingsocial-networking system 1860. In particular embodiments, however,social-networking system 1860 and third-party systems 1870 may operatein conjunction with each other to provide social-networking services tousers of social-networking system 1860 or third-party systems 1870. Inthis sense, social-networking system 1860 may provide a platform, orbackbone, which other systems, such as third-party systems 1870, may useto provide social-networking services and functionality to users acrossthe Internet.

In particular embodiments, a third-party system 1870 may include athird-party content object provider. A third-party content objectprovider may include one or more sources of content objects, which maybe communicated to a client system 1830. As an example and not by way oflimitation, content objects may include information regarding things oractivities of interest to the user, such as, for example, movie showtimes, movie reviews, restaurant reviews, restaurant menus, productinformation and reviews, or other suitable information. As anotherexample and not by way of limitation, content objects may includeincentive content objects, such as coupons, discount tickets, giftcertificates, or other suitable incentive objects.

In particular embodiments, social-networking system 1860 also includesuser-generated content objects, which may enhance a user's interactionswith social-networking system 1860. User-generated content may includeanything a user can add, upload, send, or “post” to social-networkingsystem 1860. As an example and not by way of limitation, a usercommunicates posts to social-networking system 1860 from a client system1830. Posts may include data such as status updates or other textualdata, location information, photos, videos, links, music or othersimilar data or media. Content may also be added to social-networkingsystem 1860 by a third-party through a “communication channel,” such asa newsfeed or stream.

In particular embodiments, social-networking system 1860 may include avariety of servers, sub-systems, programs, modules, logs, and datastores. In particular embodiments, social-networking system 1860 mayinclude one or more of the following: a web server, action logger,API-request server, relevance-and-ranking engine, content-objectclassifier, notification controller, action log,third-party-content-object-exposure log, inference module,authorization/privacy server, search module, advertisement-targetingmodule, user-interface module, user-profile store, connection store,third-party content store, or location store. Social-networking system1860 may also include suitable components such as network interfaces,security mechanisms, load balancers, failover servers,management-and-network-operations consoles, other suitable components,or any suitable combination thereof. In particular embodiments,social-networking system 1860 may include one or more user-profilestores for storing user profiles. A user profile may include, forexample, biographic information, demographic information, behavioralinformation, social information, or other types of descriptiveinformation, such as work experience, educational history, hobbies orpreferences, interests, affinities, or location. Interest informationmay include interests related to one or more categories. Categories maybe general or specific. As an example and not by way of limitation, if auser “likes” an article about a brand of shoes the category may be thebrand, or the general category of “shoes” or “clothing.” A connectionstore may be used for storing connection information about users. Theconnection information may indicate users who have similar or commonwork experience, group memberships, hobbies, educational history, or arein any way related or share common attributes. The connectioninformation may also include user-defined connections between differentusers and content (both internal and external). A web server may be usedfor linking social-networking system 1860 to one or more client systems1830 or one or more third-party system 1870 via network 1810. The webserver may include a mail server or other messaging functionality forreceiving and routing messages between social-networking system 1860 andone or more client systems 1830. An API-request server may allow athird-party system 1870 to access information from social-networkingsystem 1860 by calling one or more APIs. An action logger may be used toreceive communications from a web server about a user's actions on oroff social-networking system 1860. In conjunction with the action log, athird-party-content-object log may be maintained of user exposures tothird-party-content objects. A notification controller may provideinformation regarding content objects to a client system 1830.Information may be pushed to a client system 1830 as notifications, orinformation may be pulled from client system 1830 responsive to arequest received from client system 1830. Authorization servers may beused to enforce one or more privacy settings of the users ofsocial-networking system 1860. A privacy setting of a user determineshow particular information associated with a user can be shared. Theauthorization server may allow users to opt in to or opt out of havingtheir actions logged by social-networking system 1860 or shared withother systems (e.g., third-party system 1870), such as, for example, bysetting appropriate privacy settings. Third-party-content-object storesmay be used to store content objects received from third parties, suchas a third-party system 1870. Location stores may be used for storinglocation information received from client systems 1830 associated withusers. Advertisement-pricing modules may combine social information, thecurrent time, location information, or other suitable information toprovide relevant advertisements, in the form of notifications, to auser.

Vector Spaces and Embeddings

FIG. 19 illustrates an example view of a vector space 1900. Inparticular embodiments, an object or an n-gram may be represented in ad-dimensional vector space, where d denotes any suitable number ofdimensions. Although the vector space 1900 is illustrated as athree-dimensional space, this is for illustrative purposes only, as thevector space 1900 may be of any suitable dimension. In particularembodiments, an n-gram may be represented in the vector space 1900 as avector referred to as a term embedding. Each vector may comprisecoordinates corresponding to a particular point in the vector space 1900(i.e., the terminal point of the vector). As an example and not by wayof limitation, vectors 1910, 1920, and 1930 may be represented as pointsin the vector space 1900, as illustrated in FIG. 19. An n-gram may bemapped to a respective vector representation. As an example and not byway of limitation, n-grams t₁ and t₂ may be mapped to vectors

and

in the vector space 1900, respectively, by applying a function

defined by a dictionary, such that

=

(t₁) and

=

(t₂). As another example and not by way of limitation, a dictionarytrained to map text to a vector representation may be utilized, or sucha dictionary may be itself generated via training. As another exampleand not by way of limitation, a model, such as Word2vec, may be used tomap an n-gram to a vector representation in the vector space 1900. Inparticular embodiments, an n-gram may be mapped to a vectorrepresentation in the vector space 1900 by using a machine leaning model(e.g., a neural network). The machine learning model may have beentrained using a sequence of training data (e.g., a corpus of objectseach comprising n-grams).

In particular embodiments, an object may be represented in the vectorspace 1900 as a vector referred to as a feature vector or an objectembedding. As an example and not by way of limitation, objects e₁ and e₂may be mapped to vectors

and

in the vector space 1900, respectively, by applying a function

, such that

={right arrow over (π)}(e₁) and

={right arrow over (π)}(e₂). In particular embodiments, an object may bemapped to a vector based on one or more properties, attributes, orfeatures of the object, relationships of the object with other objects,or any other suitable information associated with the object. As anexample and not by way of limitation, a function {right arrow over (π)}may map objects to vectors by feature extraction, which may start froman initial set of measured data and build derived values (e.g.,features). As an example and not by way of limitation, an objectcomprising a video or an image may be mapped to a vector by using analgorithm to detect or isolate various desired portions or shapes of theobject. Features used to calculate the vector may be based oninformation obtained from edge detection, corner detection, blobdetection, ridge detection, scale-invariant feature transformation, edgedirection, changing intensity, autocorrelation, motion detection,optical flow, thresholding, blob extraction, template matching, Houghtransformation (e.g., lines, circles, ellipses, arbitrary shapes), orany other suitable information. As another example and not by way oflimitation, an object comprising audio data may be mapped to a vectorbased on features such as a spectral slope, a tonality coefficient, anaudio spectrum centroid, an audio spectrum envelope, a Mel-frequencycepstrum, or any other suitable information. In particular embodiments,when an object has data that is either too large to be efficientlyprocessed or comprises redundant data, a function {right arrow over (π)}may map the object to a vector using a transformed reduced set offeatures (e.g., feature selection). In particular embodiments, afunction {right arrow over (π)} may map an object e to a vector {rightarrow over (π)}(e) based on one or more n-grams associated with objecte. Although this disclosure describes representing an n-gram or anobject in a vector space in a particular manner, this disclosurecontemplates representing an n-gram or an object in a vector space inany suitable manner.

In particular embodiments, the social-networking system 1860 maycalculate a similarity metric of vectors in vector space 1900. Asimilarity metric may be a cosine similarity, a Minkowski distance, aMahalanobis distance, a Jaccard similarity coefficient, or any suitablesimilarity metric. As an example and not by way of limitation, asimilarity metric of

and

may be a cosine similarity

$\frac{\overset{\rightarrow}{v_{1}} \cdot \overset{\rightarrow}{v_{2}}}{{\overset{\rightarrow}{v_{1}}}{\overset{\rightarrow}{v_{2}}}}.$

As another example and not by way of limitation, a similarity metric of

and

may be a Euclidean distance ∥

−

∥. A similarity metric of two vectors may represent how similar the twoobjects or n-grams corresponding to the two vectors, respectively, areto one another, as measured by the distance between the two vectors inthe vector space 1900. As an example and not by way of limitation,vector 1910 and vector 1920 may correspond to objects that are moresimilar to one another than the objects corresponding to vector 1910 andvector 1930, based on the distance between the respective vectors.Although this disclosure describes calculating a similarity metricbetween vectors in a particular manner, this disclosure contemplatescalculating a similarity metric between vectors in any suitable manner.

More information on vector spaces, embeddings, feature vectors, andsimilarity metrics may be found in U.S. patent application Ser. No.14/949,436, filed 23 Nov. 2015, U.S. patent application Ser. No.15/286,315, filed 5 Oct. 2016, and U.S. patent application Ser. No.15/365,789, filed 30 Nov. 2016, each of which is incorporated byreference.

Systems and Methods

FIG. 20 illustrates an example computer system 2000. In particularembodiments, one or more computer systems 2000 perform one or more stepsof one or more methods described or illustrated herein. In particularembodiments, one or more computer systems 2000 provide functionalitydescribed or illustrated herein. In particular embodiments, softwarerunning on one or more computer systems 2000 performs one or more stepsof one or more methods described or illustrated herein or providesfunctionality described or illustrated herein. Particular embodimentsinclude one or more portions of one or more computer systems 2000.Herein, reference to a computer system may encompass a computing device,and vice versa, where appropriate. Moreover, reference to a computersystem may encompass one or more computer systems, where appropriate.

This disclosure contemplates any suitable number of computer systems2000. This disclosure contemplates computer system 2000 taking anysuitable physical form. As example and not by way of limitation,computer system 2000 may be an embedded computer system, asystem-on-chip (SOC), a single-board computer system (SBC) (such as, forexample, a computer-on-module (COM) or system-on-module (SOM)), adesktop computer system, a laptop or notebook computer system, aninteractive kiosk, a mainframe, a mesh of computer systems, a mobiletelephone, a personal digital assistant (PDA), a server, a tabletcomputer system, an augmented/virtual reality device, or a combinationof two or more of these. Where appropriate, computer system 2000 mayinclude one or more computer systems 2000; be unitary or distributed;span multiple locations; span multiple machines; span multiple datacenters; or reside in a cloud, which may include one or more cloudcomponents in one or more networks. Where appropriate, one or morecomputer systems 2000 may perform without substantial spatial ortemporal limitation one or more steps of one or more methods describedor illustrated herein. As an example and not by way of limitation, oneor more computer systems 2000 may perform in real time or in batch modeone or more steps of one or more methods described or illustratedherein. One or more computer systems 2000 may perform at different timesor at different locations one or more steps of one or more methodsdescribed or illustrated herein, where appropriate.

In particular embodiments, computer system 2000 includes a processor2002, memory 2004, storage 2006, an input/output (I/O) interface 2008, acommunication interface 2010, and a bus 2012. Although this disclosuredescribes and illustrates a particular computer system having aparticular number of particular components in a particular arrangement,this disclosure contemplates any suitable computer system having anysuitable number of any suitable components in any suitable arrangement.

In particular embodiments, processor 2002 includes hardware forexecuting instructions, such as those making up a computer program. Asan example and not by way of limitation, to execute instructions,processor 2002 may retrieve (or fetch) the instructions from an internalregister, an internal cache, memory 2004, or storage 2006; decode andexecute them; and then write one or more results to an internalregister, an internal cache, memory 2004, or storage 2006. In particularembodiments, processor 2002 may include one or more internal caches fordata, instructions, or addresses. This disclosure contemplates processor2002 including any suitable number of any suitable internal caches,where appropriate. As an example and not by way of limitation, processor2002 may include one or more instruction caches, one or more datacaches, and one or more translation lookaside buffers (TLBs).Instructions in the instruction caches may be copies of instructions inmemory 2004 or storage 2006, and the instruction caches may speed upretrieval of those instructions by processor 2002. Data in the datacaches may be copies of data in memory 2004 or storage 2006 forinstructions executing at processor 2002 to operate on; the results ofprevious instructions executed at processor 2002 for access bysubsequent instructions executing at processor 2002 or for writing tomemory 2004 or storage 2006; or other suitable data. The data caches mayspeed up read or write operations by processor 2002. The TLBs may speedup virtual-address translation for processor 2002. In particularembodiments, processor 2002 may include one or more internal registersfor data, instructions, or addresses. This disclosure contemplatesprocessor 2002 including any suitable number of any suitable internalregisters, where appropriate. Where appropriate, processor 2002 mayinclude one or more arithmetic logic units (ALUs); be a multi-coreprocessor; or include one or more processors 2002. Although thisdisclosure describes and illustrates a particular processor, thisdisclosure contemplates any suitable processor.

In particular embodiments, memory 2004 includes main memory for storinginstructions for processor 2002 to execute or data for processor 2002 tooperate on. As an example and not by way of limitation, computer system2000 may load instructions from storage 2006 or another source (such as,for example, another computer system 2000) to memory 2004. Processor2002 may then load the instructions from memory 2004 to an internalregister or internal cache. To execute the instructions, processor 2002may retrieve the instructions from the internal register or internalcache and decode them. During or after execution of the instructions,processor 2002 may write one or more results (which may be intermediateor final results) to the internal register or internal cache. Processor2002 may then write one or more of those results to memory 2004. Inparticular embodiments, processor 2002 executes only instructions in oneor more internal registers or internal caches or in memory 2004 (asopposed to storage 2006 or elsewhere) and operates only on data in oneor more internal registers or internal caches or in memory 2004 (asopposed to storage 2006 or elsewhere). One or more memory buses (whichmay each include an address bus and a data bus) may couple processor2002 to memory 2004. Bus 2012 may include one or more memory buses, asdescribed below. In particular embodiments, one or more memorymanagement units (MMUs) reside between processor 2002 and memory 2004and facilitate accesses to memory 2004 requested by processor 2002. Inparticular embodiments, memory 2004 includes random access memory (RAM).This RAM may be volatile memory, where appropriate. Where appropriate,this RAM may be dynamic RAM (DRAM) or static RAM (SRAM). Moreover, whereappropriate, this RAM may be single-ported or multi-ported RAM. Thisdisclosure contemplates any suitable RAM. Memory 2004 may include one ormore memories 2004, where appropriate. Although this disclosuredescribes and illustrates particular memory, this disclosurecontemplates any suitable memory.

In particular embodiments, storage 2006 includes mass storage for dataor instructions. As an example and not by way of limitation, storage2006 may include a hard disk drive (HDD), a floppy disk drive, flashmemory, an optical disc, a magneto-optical disc, magnetic tape, or aUniversal Serial Bus (USB) drive or a combination of two or more ofthese. Storage 2006 may include removable or non-removable (or fixed)media, where appropriate. Storage 2006 may be internal or external tocomputer system 2000, where appropriate. In particular embodiments,storage 2006 is non-volatile, solid-state memory. In particularembodiments, storage 2006 includes read-only memory (ROM). Whereappropriate, this ROM may be mask-programmed ROM, programmable ROM(PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM),electrically alterable ROM (EAROM), or flash memory or a combination oftwo or more of these. This disclosure contemplates mass storage 2006taking any suitable physical form. Storage 2006 may include one or morestorage control units facilitating communication between processor 2002and storage 2006, where appropriate. Where appropriate, storage 2006 mayinclude one or more storages 2006. Although this disclosure describesand illustrates particular storage, this disclosure contemplates anysuitable storage.

In particular embodiments, I/O interface 2008 includes hardware,software, or both, providing one or more interfaces for communicationbetween computer system 2000 and one or more I/O devices. Computersystem 2000 may include one or more of these I/O devices, whereappropriate. One or more of these I/O devices may enable communicationbetween a person and computer system 2000. As an example and not by wayof limitation, an I/O device may include a keyboard, keypad, microphone,monitor, mouse, printer, scanner, speaker, still camera, stylus, tablet,touch screen, trackball, video camera, another suitable I/O device or acombination of two or more of these. An I/O device may include one ormore sensors. This disclosure contemplates any suitable I/O devices andany suitable I/O interfaces 2008 for them. Where appropriate, I/Ointerface 2008 may include one or more device or software driversenabling processor 2002 to drive one or more of these I/O devices. I/Ointerface 2008 may include one or more I/O interfaces 2008, whereappropriate. Although this disclosure describes and illustrates aparticular I/O interface, this disclosure contemplates any suitable I/Ointerface.

In particular embodiments, communication interface 2010 includeshardware, software, or both providing one or more interfaces forcommunication (such as, for example, packet-based communication) betweencomputer system 2000 and one or more other computer systems 2000 or oneor more networks. As an example and not by way of limitation,communication interface 2010 may include a network interface controller(NIC) or network adapter for communicating with an Ethernet or otherwire-based network or a wireless NIC (WNIC) or wireless adapter forcommunicating with a wireless network, such as a WI-FI network. Thisdisclosure contemplates any suitable network and any suitablecommunication interface 2010 for it. As an example and not by way oflimitation, computer system 2000 may communicate with an ad hoc network,a personal area network (PAN), a local area network (LAN), a wide areanetwork (WAN), a metropolitan area network (MAN), or one or moreportions of the Internet or a combination of two or more of these. Oneor more portions of one or more of these networks may be wired orwireless. As an example, computer system 2000 may communicate with awireless PAN (WPAN) (such as, for example, a BLUETOOTH WPAN), a WI-FInetwork, a WI-MAX network, a cellular telephone network (such as, forexample, a Global System for Mobile Communications (GSM) network), orother suitable wireless network or a combination of two or more ofthese. Computer system 2000 may include any suitable communicationinterface 2010 for any of these networks, where appropriate.Communication interface 2010 may include one or more communicationinterfaces 2010, where appropriate. Although this disclosure describesand illustrates a particular communication interface, this disclosurecontemplates any suitable communication interface.

In particular embodiments, bus 2012 includes hardware, software, or bothcoupling components of computer system 2000 to each other. As an exampleand not by way of limitation, bus 2012 may include an AcceleratedGraphics Port (AGP) or other graphics bus, an Enhanced Industry StandardArchitecture (EISA) bus, a front-side bus (FSB), a HYPERTRANSPORT (HT)interconnect, an Industry Standard Architecture (ISA) bus, an INFINIBANDinterconnect, a low-pin-count (LPC) bus, a memory bus, a Micro ChannelArchitecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, aPCI-Express (PCIe) bus, a serial advanced technology attachment (SATA)bus, a Video Electronics Standards Association local (VLB) bus, oranother suitable bus or a combination of two or more of these. Bus 2012may include one or more buses 2012, where appropriate. Although thisdisclosure describes and illustrates a particular bus, this disclosurecontemplates any suitable bus or interconnect.

Herein, a computer-readable non-transitory storage medium or media mayinclude one or more semiconductor-based or other integrated circuits(ICs) (such, as for example, field-programmable gate arrays (FPGAs) orapplication-specific ICs (ASICs)), hard disk drives (HDDs), hybrid harddrives (HHDs), optical discs, optical disc drives (ODDs),magneto-optical discs, magneto-optical drives, floppy diskettes, floppydisk drives (FDDs), magnetic tapes, solid-state drives (SSDs),RAM-drives, SECURE DIGITAL cards or drives, any other suitablecomputer-readable non-transitory storage media, or any suitablecombination of two or more of these, where appropriate. Acomputer-readable non-transitory storage medium may be volatile,non-volatile, or a combination of volatile and non-volatile, whereappropriate.

Herein, “or” is inclusive and not exclusive, unless expressly indicatedotherwise or indicated otherwise by context. Therefore, herein, “A or B”means “A, B, or both,” unless expressly indicated otherwise or indicatedotherwise by context. Moreover, “and” is both joint and several, unlessexpressly indicated otherwise or indicated otherwise by context.Therefore, herein, “A and B” means “A and B, jointly or severally,”unless expressly indicated otherwise or indicated otherwise by context.

The scope of this disclosure encompasses all changes, substitutions,variations, alterations, and modifications to the example embodimentsdescribed or illustrated herein that a person having ordinary skill inthe art would comprehend. The scope of this disclosure is not limited tothe example embodiments described or illustrated herein. Moreover,although this disclosure describes and illustrates respectiveembodiments herein as including particular components, elements,feature, functions, operations, or steps, any of these embodiments mayinclude any combination or permutation of any of the components,elements, features, functions, operations, or steps described orillustrated anywhere herein that a person having ordinary skill in theart would comprehend. Furthermore, reference in the appended claims toan apparatus or system or a component of an apparatus or system beingadapted to, arranged to, capable of, configured to, enabled to, operableto, or operative to perform a particular function encompasses thatapparatus, system, component, whether or not it or that particularfunction is activated, turned on, or unlocked, as long as thatapparatus, system, or component is so adapted, arranged, capable,configured, enabled, operable, or operative. Additionally, although thisdisclosure describes or illustrates particular embodiments as providingparticular advantages, particular embodiments may provide none, some, orall of these advantages.

What is claimed is:
 1. A method, by a computing device, comprising:receiving a request to identify k steps for an entity to acquire atarget attribute in public sentiments, wherein the request comprising aname for the entity and an n-gram representing the target attribute;identifying a first word embedding for the entity and a second wordembedding for the target attribute, wherein each word embeddingrepresents a semantic context of a corresponding n-gram as a point in ad-dimensional embedding space; determining a directional vector thatconnects from the first word embedding to the second word embedding inthe embedding space; identifying k word embeddings that corresponds to kpoints on the directional vector, respectively; and determining, foreach of the k identified word embeddings, a corresponding n-gram,wherein each n-gram represents an attribute located along a path for theentity to the target attribute in the embedding space.
 2. The method ofclaim 1, wherein the first word embedding is identified by looking upthe name for the entity in a word-embedding table, wherein the secondword embedding is identified by looking up the n-gram representing thetarget attribute in the word-embedding table, and wherein theword-embedding table comprises a plurality of unique n-grams and theircorresponding word embeddings.
 3. The method of claim 2, wherein theplurality of unique n-grams in the table are selected from a corpus oftext, wherein the corpus of text was collected from a plurality ofuser-created content objects in the online social network.
 4. The methodof claim 3, wherein the table represents results of a word embeddingmodel trained using the corpus of text as training data.
 5. The methodof claim 4, wherein the word embedding model is a word2vec model.
 6. Themethod of claim 4, wherein the request comprises one or more conditionscharacterizing an audience.
 7. The method of claim 6, furthercomprising: constructing the corpus of text by collecting text contentfrom content objects created by a group of users of the online socialnetwork, wherein the group satisfies the one or more conditions;identifying a list of unique n-grams appearing in the corpus of text;training a word embedding model using the corpus of text, wherein theword embedding model generates word embeddings corresponding to theunique n-grams; and generating, using the word embedding model, thetable based on the list of unique n-grams and their corresponding wordembeddings.
 8. The method of claim 7, wherein the content objects werecreated within a pre-determined period of time.
 9. The method of claim1, wherein the identifying the k word embeddings comprises: identifyingk points on the directional vector that evenly split the directionalvector into k+1 segments; computing, for each of the identified kpoints, a similarity metric for each word embedding in the table to thepoint; and selecting, for each of the identified k points, a wordembedding that has a highest similarity metric to the point.
 10. Themethod of claim 9, wherein the similarity metric is a cosign similarity,a Euclidean distance, or a Jaccard similarity coefficient.
 11. One ormore computer-readable non-transitory storage media embodying softwarethat is operable when executed to: receive a request to identify k stepsfor an entity to acquire a target attribute in public sentiments,wherein the request comprising a name for the entity and an n-gramrepresenting the target attribute; identify a first word embedding forthe entity and a second word embedding for the target attribute, whereineach word embedding represents a semantic context of a correspondingn-gram as a point in a d-dimensional embedding space; determine adirectional vector that connects from the first word embedding to thesecond word embedding in the embedding space; identify k word embeddingsthat corresponds to k points on the directional vector, respectively;and determine, for each of the k identified word embeddings, acorresponding n-gram, wherein each n-gram represents an attributelocated along a path for the entity to the target attribute in theembedding space.
 12. The media of claim 11, wherein the first wordembedding is identified by looking up the name for the entity in aword-embedding table, wherein the second word embedding is identified bylooking up the n-gram representing the target attribute in theword-embedding table, and wherein the word-embedding table comprises aplurality of unique n-grams and their corresponding word embeddings. 13.The media of claim 12, wherein the plurality of unique n-grams in thetable are selected from a corpus of text, wherein the corpus of text wascollected from a plurality of user-created content objects in the onlinesocial network.
 14. The media of claim 13, wherein the table representsresults of a word embedding model trained using the corpus of text astraining data.
 15. The media of claim 14, wherein the word embeddingmodel is a word2vec model.
 16. The media of claim 14, wherein therequest comprises one or more conditions characterizing an audience. 17.The media of claim 16, wherein the software is further operable whenexecuted to: constructing the corpus of text by collecting text contentfrom content objects created by a group of users of the online socialnetwork, wherein the group satisfies the one or more conditions;identifying a list of unique n-grams appearing in the corpus of text;training a word embedding model using the corpus of text, wherein theword embedding model generates word embeddings corresponding to theunique n-grams; and generating, using the word embedding model, thetable based on the list of unique n-grams and their corresponding wordembeddings.
 18. The media of claim 11, wherein the identifying the kword embeddings comprises: identifying k points on the directionalvector that evenly split the directional vector into k+1 segments;computing, for each of the identified k points, a similarity metric foreach word embedding in the table to the point; and selecting, for eachof the identified k points, a word embedding that has a highestsimilarity metric to the point.
 19. The media of claim 18, wherein thesimilarity metric is a cosign similarity, a Euclidean distance, or aJaccard similarity coefficient.
 20. A system comprising: one or moreprocessors; and one or more computer-readable non-transitory storagemedia coupled to one or more of the processors and comprisinginstructions operable when executed by one or more of the processors tocause the system to: receive a request to identify k steps for an entityto acquire a target attribute in public sentiments, wherein the requestcomprising a name for the entity and an n-gram representing the targetattribute; identify a first word embedding for the entity and a secondword embedding for the target attribute, wherein each word embeddingrepresents a semantic context of a corresponding n-gram as a point in ad-dimensional embedding space; determine a directional vector thatconnects from the first word embedding to the second word embedding inthe embedding space; identify k word embeddings that corresponds to kpoints on the directional vector, respectively; and determine, for eachof the k identified word embeddings, a corresponding n-gram, whereineach n-gram represents an attribute located along a path for the entityto the target attribute in the embedding space.